One of the ways tasks communicate is by sending messages to each other. This procedure creates an item for a buffered message (a message that includes an internal buffer for sending data to the receiving task). You can use this procedure in place of CreateItem() to create the message.
Arguments
name
The name of the message (see "Notes").
pri
The priority of the message. This determines the position of the message in the receiving task's message queue and thus, how soon it is likely to be handled. A larger number specifies a higher priority.
mp
The item number of the message port at which to receive the reply.
datasize
The maximum size of the message's internal buffer, in bytes.
Return Value
The procedure returns the item number of the message or an error code if an error occurs.
Implementation
Convenience call implemented in clib.lib V20.
Associated Files
msgport.h
ANSI C Prototype
clib.lib
ARM Link Library
Notes
The advantage of using a buffered message instead of a standard message is that the sending task doesn't need to keep the data block containing the message data after the message is sent. All the necessary data is included in the message.
The same message item can be resent any number of times. When you are finished with a message item, use DeleteMsg() to delete it.
You can use FindNamedItem() to find a message item by name. When creating messages, you should assign unique names whenever possible.
Caveats
The priority value (set with the pri argument) is not used consistently.