OS_SendMessage

Syntax

#include <nitro/os.h>
BOOL OS_SendMessage(
     OSMessageQueue*   mq,
     OSMessage         msg,
     s32               flag );
  

Arguments

mq Pointer to the message queue
msg Transmission message
flag When OS_MESSAGE_BLOCK is set, OS_SendMessage blocks when the queue is full. When OS_MESSAGE_NOBLOCK is set, OS_SendMessage returns whether the queue is full or not.

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.

Description

Inserts a message at the end of the specified message queue. Also, puts the threads waiting in the message queue into executable state. The receiving threads are executed in order of priority.

If OS_MESSAGE_BLOCK is set in flag and the queue is full, the thread that called this function is temporarily stopped. This thread immediately restarts when a receiving thread operates to remove messages from the queue. Be aware that if there are any other sending threads with a higher priority, those will operate first and the queue may fill up again. In such a case, this thread will be suspended again until the receiving thread makes an opening in the message queue.

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

See Also

OS_InitMessageQueue
OS_ReceiveMessage
OS_JamMessage

Revision History

2003/12/05 Initial version.


CONFIDENTIAL