MSGQ_getSrcQueue
2-248
C Interface
Syntax
status = MSGQ_getSrcQueue(msg, msgqQueue);
Parameters
MSGQ_Msg
msg;
/* Received message */
MSGQ_Queue
*msgqQueue;
/* Message queue */
Return Value
Int
status;
/* status */
Reentrant
yes
Description
Many times a receiver of a message wants to reply to the sender of the
message (for example, to send an acknowledgement). When a valid
msgqQueue is specified in MSGQ_setSrcQueue, the receiver of the
message can extract the message queue via MSGQ_getSrcQueue.
This is basically the same as a MSGQ_locate function without knowing
the name of the message queue. This function can be used even if the
queueName used with MSGQ_open was NULL or non-unique.
Note: The msgqQueue may not be the sender's message queue handle.
The sender is free to use any created message queue handle.
This function can be called from a HWI, SWI or TSK.
If successful, this function returns SYS_OK.
Example
/* Get the handle and send the message back. */
status = MSGQ_getSrcQueue((MSGQ_Msg)msg, &replyQueue);
if (status != SYS_OK) {
/* Free the message and abort */
MSGQ_free((MSGQ_Msg)msg);
SYS_abort("Failed to get handle from message");
}
status = MSGQ_put(replyQueue, (MSGQ_Msg)msg);
See Also
MSGQ_getSrcQueue
Extract the reply destination from a message