Waiting for a Single Event for Read/Write
Before reading data, a connection must be established between two endpoint processes. This
         can be done by calling NvSciIpcGetEventSafe(). 
Basic event handling mechanism is already described in 
            Writing to the NvSciIpc Endpoint
          section. (The only difference is calling WaitForEvent() instead of
               select()). 
Note: 
         
      WaitForEvent() is an event-blocking call. It must be called from a single thread only.
To process the write event in a loop, add the WRITE event
         check routine and NvSciIpcWriteSafe().
Wait for a single event for read
NvSciEventLoopService *eventLoopService;
NvSciIpcEndpoint ipcEndpoint;
NvSciEventNotifier *eventNotifier;
struct NvSciIpcEndpointInfo info;
int64_t timeout;
uint32_t event = 0;
void *buf;
int32_t buf_size, bytes;
int retval;
NvSciError err;
timeout = NV_SCI_EVENT_INFINITE_WAIT;
buf = malloc(info.frame_size);
if (buf == NULL) {
    goto fail;
}  
buf_size = info.frame_size;
while (1) {
       err = NvSciIpcGetEventSafe(ipcEndpoint, &event);
       if (err != NvSciError_Success) {
                goto fail;
       }
       if (event & NV_SCI_IPC_EVENT_READ) {
               /* Assuming buf contains pointer to area where frame is read.
                * buf_size contains the size of data. It should be less than
                * Endpoint frame size.
                */
               err = NvSciIpcReadSafe(ipcEndpoint, buf, buf_size, &bytes);
               if(err != NvSciError_Success) {
                      printf("error in reading endpoint\n");
                      goto fail;
               }
       } else {                      
               err = eventLoopService->WaitForEvent(eventNotifier, timeout);
               if(err != NvSciError_Success) {
                      printf("error in waiting event\n");
                      goto fail;
               }
        }
}