/* This file is part of Lcrzo.
*/

int lcrzo_ipc_close_write(lcrzo_ipc *pipc)
{ 
  /*parameters verification*/
  if (pipc==NULL) return(LCRZO_ERR_PANULLPTR);
  if (pipc->side!=0&&pipc->side!=1) return(LCRZO_ERR_LOIPCSIDENOTSET);

  if (pipc->openforwriting)
  { 
#if defined LCRZODEF_SYSTEM_Unix
    { int ret=close(pipc->writepipe[pipc->side]);
      if (ret==-1) return(LCRZO_ERR_FUCLOSE); 
    }
#elif defined LCRZODEF_SYSTEM_Windows
    /* do not really close because we use threads */
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif
    pipc->openforwriting=LCRZO_FALSE;
  }

  return(LCRZO_ERR_OK);
}


