1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>OS_SendMessage</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_SendMessage <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15<PRE><CODE>#include &lt;nitro/os.h&gt;</CODE></PRE>
16  <PRE><CODE>BOOL OS_SendMessage(
17     OSMessageQueue*   mq,
18     OSMessage         msg,
19     s32               flag );
20  </CODE></PRE>
21</DL>
22<H2>Arguments</H2>
23<TABLE border="1" width="100%">
24  <TBODY>
25    <TR>
26<TD width="13%"><EM><STRONG>mq</STRONG></EM></TD>
27<TD width="87%">Pointer to the message queue</TD>
28    </TR>
29    <TR>
30<TD width="13%"><EM><STRONG>msg</STRONG></EM></TD>
31<TD width="87%">Transmission message</TD>
32    </TR>
33    <TR>
34<TD><EM><STRONG>flag</STRONG></EM></TD>
35<TD>When <CODE>OS_MESSAGE_BLOCK</CODE> is set, <CODE>OS_SendMessage</CODE> blocks when the queue is full. When <CODE>OS_MESSAGE_NOBLOCK</CODE> is set, <CODE>OS_SendMessage</CODE> returns whether the queue is full or not.</TD>
36    </TR>
37  </TBODY>
38</TABLE>
39<H2>Return Values</H2>
40<P>
41<code>TRUE</code> is returned when the message is successfully sent. <code>FALSE</code> is returned when the queue is full and <CODE>OS_MESSAGE_NOBLOCK</CODE> is specified.
42</P>
43<H2>Description</H2>
44<P>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.</P>
45<P>If <code>OS_MESSAGE_BLOCK</code> is set in <em><strong><code>flag</code></strong></em> 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.</P>
46<P>When <CODE>OS_MESSAGE_NOBLOCK</CODE> is set in <em><strong><code>flag</code></strong></em>, the called thread is returned to immediately. When the queue is not full, <code>TRUE</code> is returned. If the queue is full, <CODE>FALSE</CODE> is returned.</P>
47<H2>See Also</H2>
48<P><CODE><A href="OS_InitMessageQueue.html">OS_InitMessageQueue</A><BR> <A href="OS_ReceiveMessage.html">OS_ReceiveMessage</A><BR> <A href="OS_JamMessage.html">OS_JamMessage</A><BR></CODE></P>
49<H2>Revision History</H2>
50<P>2003/12/05 Initial version.</P>
51<hr><p>CONFIDENTIAL</p></body>
52</HTML>
53