#include <revolution/os.h>
BOOL OSSendMessage(
OSMessageQueue* mq,
OSMessage msg,
s32 flags);
|
Pointer to message queue. |
msg |
Message to send. |
flags |
When OS_MESSAGE_BLOCK is set, OSSendMessage blocks the full queue. When OS_MESSAGE_NOBLOCK is set, OSSendMessage returns whether or not the queue is full. |
TRUE is returned if the message is successfully sent.
Returns FALSE if OS_MESSAGE_NOBLOCK was specified and the queue is full.
Inserts a message at the end of the specified message queue. The function makes it possible for 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 temporarily pause again until the receiving thread makes an opening in the message queue.
When OS_MESSAGE_NOBLOCK is set in flags, the called thread is returned immediately. When the queue is not full, TRUE is returned. If the queue is full, FALSE is returned.
This function may put the current thread to sleep. For precautions when calling similar functions, refer to Interrupts and Callback Functions.
Thread Functions, Thread Synchronization Functions,
OSInitMessageQueue, OSJamMessage, OSReceiveMessage, Interrupts and Callback Functions
2007/09/25 Added information on the sleeping status of threads.
2006/03/01 Initial version.
CONFIDENTIAL