This procedure gets a specific message and removes it from the message queue that contains it, if any.
A task that is receiving messages can use GetThisMsg() to get an incoming message. Unlike GetMsg(), which gets the first message in a specific message queue, GetThisMsg() can get any message from any of the task's message queues.
A task that has sent a message can use GetThisMsg() to get it back. If the receiving task hasn't already taken the message from its message queue, GetThisMsg() removes it from the queue. If the message is not on any MsgPort a zero is returned.
Arguments
message
The item number of the message to get.
Return Value
The procedure returns the item number of the message or an error code (a negative value) if an error occurred. Possible error codes include:
BADITEM
The message argument does not specify a message.
BADPRIV
The calling task is not allowed to get this message.
Implementation
SWI implemented in kernel folio V20.
Associated Files
msgport.h
ANSI C Prototype
Caveats
Prior to V21, if the message was not on any message port this procedure still returned the item number of the message. In V21 and beyond, if the message is not on any port, the procedure returns an error.