OSJamMessage

C Specification

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

Arguments

mq Pointer to message queue.
msg Message to send.
flags If set to OS_MESSAGE_BLOCK, OSJamMessage() will block on a full queue. If set to OS_MESSAGE_NOBLOCK, OSJamMessage() will return immediately whether the queue is full or not.

Return Values

TRUE is returned if the message is successfully sent.

FALSE is returned if OS_MESSAGE_NOBLOCK was specified and the queue is full.

Description

OSJamMessage is similar to OSSendMessage except that it inserts a message at the beginning of the specified message queue. Call this function when sending high priority messages.

If OS_MESSAGE_BLOCK is set in flags and the queue is full, the thread that called this function is temporarily stopped. 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 paused 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.

See Also

Thread Functions, Thread Synchronization Functions,
OSInitMessageQueue, OSReceiveMessage, OSSendMessage, Interrupts and Callback Functions

Revision History

2007/09/25 Added information on the sleeping status of threads.
2006/03/01 Initial version.


CONFIDENTIAL