# OS_JamMessage

## C Specification

      #include <nitro/os.h>

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

## Description

`OS_JamMessage()` is similar to `OS_SendMessage` except that it inserts a message at the beginning of the specified message queue. Call this function when transmitting 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. It can be restarted by running a reception thread and removing a message from the queue. Be aware that if there are transmission threads of higher priority, they will execute first and may fill up the queue. In this case, this thread will again temporarily stop until an opening in the message queue is made by the reception thread.

When `OS_MESSAGE_NOBLOCK` is set in `flags`, the called thread is returned to immediately. When the queue is not full, `TRUE` is returned. If the queue is full, `FALSE` is returned.

## Arguments

`mq` | Pointer to the message queue
`msg` | Transmission message
`flags` | When `OS_MESSAGE_BLOCK` is set, `OS_JamMessage` blocks the full queue. When `OS_MESSAGE_NOBLOCK` is set, `OS_JamMessage` returns whether or not the queue is full.

## Return Values

`TRUE` is returned when the message is successfully sent. `FALSE` is returned when the queue is full and `OS_MESSAGE_NOBLOCK` is specified.

## See Also

`OS_InitMessageQueue`, `OS_SendMessage`, `OS_ReceiveMessage`

## Revision History

12/01/2003 Initial version