/* This file is part of Lcrzo.
*/

int lcrzo_ipc_close_read(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->openforreading)
  { 
#if defined LCRZODEF_SYSTEM_Unix
    { int ret=close(pipc->readpipe[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->openforreading=LCRZO_FALSE;
  }

  pipc->dataend=LCRZO_TRUE;
  return(LCRZO_ERR_OK);
}

