wait

This method waits for a semaphore token.

Signature
RiCOSResult RiCOSSemaphore_wait(
   RiCOSSemaphore *const me, long timeout);
Parameters
me

The RiCOSSemaphore object.

timeout

The number of ticks to lock on a semaphore before timing out. The possible values are < 0 (wait indefinitely); 0 (do not wait); and > 0 (the number of ticks to wait). For Solaris systems, a value of > 0 means to wait indefinitely.

Returns

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

Example
RiCOSResult RiCOSSemaphore_wait(
   RiCOSSemaphore *  const me, long timeout)
{
   if (!(me && me->m_semId)) return FALSE;

   if (timeout < 0) timeout = WAIT_FOREVER;

   return (semTake(me->m_semId, timeout) == OK);
}

Feedback