OSSendMessage

C Specification

#include <revolution/os.h>
BOOL OSSendMessage(
OSMessageQueue*   mq,
OSMessage         msg,
s32             flags);

Arguments

mq Pointer to message queue.
msg Message to send.
flags When OS_MESSAGE_BLOCK is set and the queue is full, the OSSendMessage function blocks. When OS_MESSAGE_NOBLOCK is set, the OSSendMessage function immediately returns whether or not the queue is full.

Return Values

Returns TRUE if the message is successfully sent.

Returns FALSE if OS_MESSAGE_NOBLOCK is specified and the queue is full.

Description

This function inserts a message at the end of the specified message queue. This function allows threads waiting in the message queue to execute. The receiving threads execute in order of priority.

If flags is set to OS_MESSAGE_BLOCK and the queue is full, the calling thread will be paused. You can restart this thread by running a receiving thread and removing messages from the queue. Be aware that sending threads with a higher priority will execute first and may fill up the queue. In this case, this thread will be temporarily pause again until the receiving thread makes an opening in the message queue.

If flags is set to OS_MESSAGE_NOBLOCK, it returns to the calling thread immediately. When the queue isn't full, TRUE is returned. If the queue is full, FALSE is returned.

See Also

Thread Functions, Thread Synchronization Functions, OSInitMessageQueue, OSJamMessage, OSReceiveMessage

Revision History

03/01/2006 Initial version.