CreateMsg

Creates a standard message.

Synopsis

Item CreateMsg( const char *name, uint8 pri, Item mp )

Description

One of the ways tasks communicate is by sending messages to each other. This procedure creates an item for a standard message (a message where any data to be communicated to the receiving task is contained in a data block allocated by the sending task). You can use this procedure in place of CreateItem() to create the item.

To create a buffered message (a message that includes an internal buffer for sending data to the receiving task), use CreateBufferedMsg(). To create a small message (a message that can contain up to eight bytes of data), use CreateSmallMsg().

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.

Return Value

The procedure returns the item number of the message or an error code (a negative value) 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 same message item can be reused for any number of messages. 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.

See Also

CreateMsgPort(), CreateBufferedMsg(), CreateSmallMsg(), DeleteMsg(), DeleteMsgPort(), SendMsg()