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="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>OSSendMessage</TITLE>
9</HEAD>
10<BODY>
11<H1>OSSendMessage</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/os.h&gt;
16
17BOOL OSSendMessage(
18    OSMessageQueue* mq,
19    OSMessage       msg,
20    s32             flags);
21</pre></dd></dl>
22
23<H2>Arguments</H2>
24<TABLE class="arguments" border="1" >
25  <TBODY>
26    <TR>
27<TH><STRONG><EM><CODE>mq</CODE></EM></STRONG></TH>
28<TD>Pointer to message queue.</TD>
29    </TR>
30    <TR>
31<TH>msg</TH>
32<TD>Message to send.</TD>
33    </TR>
34    <TR>
35<TH>flags</TH>
36<TD>When <CODE>OS_MESSAGE_BLOCK</CODE> is set, the <CODE>OSSendMessage</CODE> function blocks if the queue is full. When <CODE>OS_MESSAGE_NOBLOCK</CODE> is set, the <CODE>OSSendMessage</CODE> function returns whether or not the queue is full.</TD>
37    </TR>
38  </TBODY>
39</TABLE>
40
41<H2>Return Values</H2>
42<P>Returns <CODE>TRUE</CODE> if the message was successfully sent.</P>
43<P>Returns <CODE>FALSE</CODE> if <CODE>OS_MESSAGE_NOBLOCK</CODE> was specified and the queue is full.</P>
44
45<H2>Description</H2>
46<P>Inserts a message at the end of the specified message queue. The function makes it possible for threads waiting in the message queue to execute. The receiving threads execute in order of priority.</P>
47<P>If <SPAN class="argument">flags</SPAN> is set to <CODE>OS_MESSAGE_BLOCK</CODE> and the queue is full, the calling thread will be paused. 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 temporarily pause again until the receiving thread makes an opening in the message queue.</P>
48<P>When <CODE>OS_MESSAGE_NOBLOCK</CODE> is set in <SPAN class="argument">flags</SPAN>, immediately returns to the calling thread. When the queue is not full, <CODE>TRUE</CODE> is returned. If the queue is full, <CODE>FALSE</CODE> is returned.</P>
49
50<H2>See Also</H2>
51<P class="reference">
52<A href="../toc.html#Thread" target="contents">Thread Functions</A>,
53<A href="../toc.html#ThreadSynchronization" target="contents">Thread Synchronization Functions</A>,
54<A href="OSInitMessageQueue.html">OSInitMessageQueue</A>,
55<A href="OSJamMessage.html">OSJamMessage</A>,
56<A href="OSReceiveMessage.html">OSReceiveMessage</A>
57</P>
58
59<H2>Revision History</H2>
60<P>
612006/03/01 Initial version.<br>
62</p>
63
64<hr><p>CONFIDENTIAL</p></body>
65</HTML>