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


mq Pointer to message queue.
msg Pointer to OSMessage 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 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.


Inserts a message at the end of the specified message queue. If any threads are currently blocked because of an empty queue, they will be executed after this function. 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. 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. If the queue is not full, TRUE is returned. If the queue is full, FALSE is returned.

The system message queue must be called at least once using the NOBLOCK flag.

Do Not Call From

Callbacks Do not call this function from any callback function.

See Also


Revision History

2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup pass.
2011/03/21 API revised to take pointer to OSMessage.
2010/08/30 Initial version.