MSGQ_get
Application Program Interface
2-243
C Interface
Syntax
status = MSGQ_get(msgqQueue, msg, timeout);
Parameters
MSGQ_Queue
msgqQueue;
/* Message queue */
MSGQ_Msg *msg;
/*
Pointer
to the returned message */
Uns
timeout;
/* Duration to block if no message */
Return Value
Int
status;
/* status */
Reentrant
yes
Description
MSGQ_get returns a message sent via MSGQ_put. The order of retrieval
is FIFO.
This function is performed by the reader. Once a message has been
received, the reader is responsible for freeing or re-sending the
message.
If no messages are present, the pend() function specified in the
MSGQ_Attrs passed to MSGQ_open for this message queue is called.
The pend() function blocks up to the timeout value (SYS_FOREVER =
forever). The timeout units are system clock ticks.
This function is deterministic if timeout is zero. MSGQ_get can be called
from a TSK with any timeout. It can be called from a HWI or SWI if the
timeout is zero.
If successful, this function returns SYS_OK. Otherwise,
SYS_ETIMEOUT is returned if the timeout expires before the message
is received.
Constraints and
Calling Context
❏
Only one reader of a message queue is allowed concurrently.
❏
The message queue must have been returned from a MSGQ_open
call.
Example
status = MSGQ_get(readerMsgQueue, (MSGQ_Msg *)&msg, 0);
if (status != SYS_OK) {
/* No messages to process */
return;
}
See Also
MSGQ_get
Receive a message from the message queue