wait

此方法會等待號誌記號。

簽章
RiCOSResult RiCOSSemaphore_wait(
   RiCOSSemaphore *const me, long timeout);
參數
me

RiCOSSemaphore 物件。

逾時

逾時之前要對號誌進行鎖定的時間計數。 可能的值是 < 0(無限期的等待);0(不等待)及 > 0(要等待的時間計數)。 對於 Solaris 系統,> 0 的值表示無限期的等待。

傳回

RiCOSResult 物件,如 RiCOS*.h 檔案所定義

範例
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);
}

回饋