pend 메소드는 큐에 메시지가 있을 때까지 호출하는 태스크를 차단합니다. 일반적으로 판독기는 큐에 읽을 수 있는 메시지가 포함될 때까지 대기합니다.
RiCOSResult RiCOSMessageQueue_pend( RiCOSMessageQueue *const me);
me
RiCOSMessageQueue입니다.
RiCOS*.h 파일에 정의된 RiCOSResult 오브젝트입니다.
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;
}