OSJamMessage

Syntax

#include <cafe/os.h>

BOOL OSJamMessage(OSMessageQueue* mq, OSMessage* msg, s32 flags);

Parameters

mq Pointer to message queue.
msg Pointer to OSMessage to send.
flags When OS_MESSAGE_BLOCK is set and the queue is full, the OSJamMessage function blocks. When OS_MESSAGE_NOBLOCK is set, the OSJamMessage 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.

Description

The OSJamMessage and the OSSendMessage functions are similar except that OSJamMessage inserts a message at the beginning of the specified message queue. Call this function when sending high-priority messages.

If flags is set to OS_MESSAGE_BLOCK and the queue is full, the thread that called this function is paused. Restart this thread by running a receiving thread and removing messages from the queue. Note that sending threads with a higher priority will execute first and may fill up the queue. In this case, this thread will be paused 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.

Do Not Call From

Callbacks Do not call this function from a callback if OS_MESSAGE_NOBLOCK is specified.

See Also

OSInitMessageQueue
OSSendMessage
OSReceiveMessage

Revision History

2013/05/08 Automated cleanup pass.
2012/08/01 Cleanup pass.
2012/05/25 Matched actual header.
2011/10/18 Initial version.


CONFIDENTIAL