pend

The pend method blocks the task making the call until there is a message in the queue. A reader generally waits until the queue contains a message that it can read.

Signature
RiCOSResult RiCOSMessageQueue_pend(
   RiCOSMessageQueue *const me);
Parameters
me

The RiCOSMessageQueue

Returns

The RiCOSResult object, as defined in the RiCOS*.h files

Example
RiCOSResult RiCOSMessageQueue_pend(
   RiCOSMessageQueue * const me)
{
   if (me == NULL) return 0;

   if (me->m_State == noData) {
      gen_ptr m = NULL;
      if (msgQReceive(me->hVxMQ, (char*)&m, sizeof(m),
         NO_WAIT) <= 0)         /* if the queue is empty *
         (void)msgQReceive(me->hVxMQ, (char*)&m,
         sizeof(m), WAIT_FOREVER);   /* wait for message */
      me->m_State = dataReady;
      me->pmessage = m;
   }
   return 1;
}

Feedback