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>OSReceiveMessage</TITLE>
9</HEAD>
10<BODY>
11<H1>OSReceiveMessage</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/os.h&gt;
16
17BOOL OSReceiveMessage(
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>Pointer to the message being received.</TD>
33    </TR>
34    <TR>
35<TH>flags</TH>
36<TD>If <CODE>OS_MESSAGE_BLOCK</CODE> is set, the <CODE>OSReceiveMessage</CODE> function blocks empty queues. When <CODE>OS_MESSAGE_NOBLOCK</CODE> is set, the <CODE>OSReceiveMessage</CODE> function immediately returns whether or not the queue is empty.</TD>
37    </TR>
38  </TBODY>
39</TABLE>
40
41<H2>Return Values</H2>
42<P>Returns <CODE>TRUE</CODE> if the message was extracted without any problems.</P>
43<P>Returns <CODE>FALSE</CODE> if <CODE>OS_MESSAGE_NOBLOCK</CODE> was specified and the queue is empty.</P>
44
45<H2>Description</H2>
46<P>Extracts messages from the message queue. With this function, you can execute any waiting threads to send a message to the queue. The sending threads execute in order of priority.</P>
47<P>When <CODE>OS_MESSAGE_BLOCK</CODE> is set in <SPAN class="argument">flags</SPAN>, the thread that called this function will be paused if the queue is empty. The thread resumes once the message is sent to the queue. Other receiving threads with a higher priority are executed first so be aware of when messages are removed. If the message queue is empty when this thread is executed, it will pause again until another message is sent to the queue.</P>
48<P>If <CODE>OS_MESSAGE_NOBLOCK</CODE> is set in <SPAN class="argument">flags</SPAN>, the process immediately returns to the calling thread. If the queue is not empty, <CODE>TRUE</CODE> is returned. If it is empty, <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="OSSendMessage.html">OSSendMessage</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>