MSGQ_put
Application Program Interface
2-257
C Interface
Syntax
status = MSGQ_put(msgqQueue, msg);
Parameters
MSGQ_Queue
msgqQueue;
/* Destination message queue */
MSGQ_Msg
msg;
/* Message */
Return Value
Int
status;
/* status */
Reentrant
yes
Description
MSGQ_put places a message into the specified message queue.
This function is performed by a writer. This function is non-blocking, and
can be called from a HWI, SWI or TSK.
The post() function for the destination message queue is called as part of
the MSGQ_put. The post() function is specified MSGQ_open call in the
MSGQ_Attrs parameter.
If successful, this function returns SYS_OK. Otherwise, it may return an
error code returned by the transport.
There are several features available when sending a message.
❏
A msgId passed to MSGQ_setMsgId can be used to indicate the type
of message it is. Such a type is completely application-specific,
except for IDs defined for MSGQ_setMsgId. The reader of a
message can use MSGQ_getMsgId to get the ID from the message.
❏
The source message queue parameter to MSGQ_setSrcQueue
allows the sender of the message to specify a source message
queue. The receiver of the message can use MSGQ_getSrcQueue
to extract the embedded message queue from the message. A
client/server application might use this mechanism because it allows
the server to reply to a message without first locating the sender. For
example, each client would have its own message queue that it
specifies as the source message queue when it sends a message to
the server. The server can use MSGQ_getSrcQueue to get the
message queue to reply back to.
If MSGQ_put returns an error, the user still owns the message and is
responsible for freeing the message (or re-sending it).
Constraints and
Calling Context
❏
The msgqQueue must have been returned from MSGQ_locate,
MSGQ_locateAsync or MSGQ_getSrcQueue (or MSGQ_open if the
reader of the message queue wants to send themselves a message).
MSGQ_put
Place a message on a message queue