#include <mipc/chMipc.h>int msgGet(int spaceLid, unsigned int msgQueueId, KnTimeVal *waitLimit, char **msgAddr, KnUniqueId *srcActor);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
msgGet returns to the caller the first message with the highest priority pending behind the message queue of index msgQueueId within the set of message queues of the message space designated by spaceLid.
waitLimit optionally specifies a timeout, and may also specify a non abortable wait.
msgAddr is the address of a pointer where to store the address of the retrieved message.
srcActor is either equal to the specific NULL constant or points to a structure of type KnUniqueId where to store the unique identifier of the source actor of the retrieved message, if any.
The first message with the highest priority pending behind the message queue is dequeued.
If no message is pending behind the message queue, the invoking thread is blocked until a message is sent to the message queue or until the timeout, if any, expires. Multiple threads can be blocked behind the same message queue. In such a case, the policy for ordering incoming messages is a simple FIFO. No data copy is performed. The receiving thread is returned a pointer to the message allocated by the sender. This thread can immediately access the content of the message, and update it before sending the message (without any extra data copy) to another message queue of the same message space.
Upon successful completion, msgGet returns 0. Otherwise, a negative error code is returned.
spaceLid is not valid, or waitLimit is not a valid KnTimeVal.
msgQueueId is not a valid message queue.
The maximum waiting time specified in waitLimit expired.
One of the following pointers is invalid: waitLimit, msgAddr or srcActor. If waitLimit is an invalid pointer, msgGet has no effect on the message queue designated by msgQueueId and returns immediately K_EFAULT. If srcActor or msgAddr is or becomes an invalid pointer (while msgGet, the message that has been dequeued is freed). Therefore the message is lost from the faulty application point of view.
The invoking thread was aborted while waiting for a message.
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|