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_PollEvent</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_PollEvent* <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>u32 OS_PollEvent( OSEvent* event,
17                      u32 pattern,
18                      OSEventMode mode );
19
20u32 OS_PollEventEx( OSEvent* event,
21                      u32 pattern,
22                      OSEventMode mode,
23                      u32 clearBit );
24
25(Inline functions)
26static inline
27u32 OS_PollEvent_And( OSEvent* event,
28                         u32 pattern );
29
30static inline
31u32 OS_PollEvent_Or( OSEvent* event,
32                         u32 pattern );
33
34static inline
35u32 OS_PollEventEx_And( OSEvent* event,
36                         u32 pattern,
37                         u32 clearBit );
38
39static inline
40u32 OS_PollEventEx_Or( OSEvent* event,
41                         u32 pattern,
42                         u32 clearBit );</CODE></PRE>
43</DL>
44<H2>Arguments</H2>
45<TABLE border="1" width="100%">
46  <TBODY>
47    <TR>
48      <TD width="13%"><EM><STRONG>event</STRONG></EM></TD>
49      <TD width="87%">Pointer to an event structure.</TD>
50    </TR>
51    <TR>
52      <TD><EM><STRONG>pattern</STRONG></EM></TD>
53      <TD>Event flag bit pattern. Takes the form of the pattern that ends waiting for events.</TD>
54    </TR>
55    <TR>
56      <TD><EM><STRONG>mode</STRONG></EM></TD>
57      <TD>Matching mode. Indicates the event flag bit pattern's conditions for conformance.</TD>
58    </TR>
59    <TR>
60      <TD width="13%"><EM><STRONG>clearBit</STRONG></EM></TD>
61      <TD width="87%">Bits to clear from the event flag after the conditions are fulfilled.</TD>
62    </TR>
63  </TBODY>
64</TABLE>
65<H2>Return Values</H2>
66<P>If 0, indicates that the conditions have not been met.<BR>A nonzero value indicates that the conditions are met, and it will be the value of the event flag. If <B><I>clearBit</I></B> is specified, this function will return the value of the event flag before the bits were cleared.</P>
67<H2>Description</H2>
68<P>Finds out whether the event structure meets the completion conditions that have been set for waiting for events.</P>
69<P><EM><B>event</B></EM> is a pointer to an event structure. This <B><I>event</I></B> argument is is initialized by <CODE><A href="OS_InitEvent.html">OS_InitEvent()</A></CODE> and is used to have threads wait for events. In the <CODE>OS_PollEvent*</CODE> functions, it is also used to find out whether the event completion conditions have been met.</P>
70<P>Unlike the function to wait for events (<CODE><A href="OS_WaitEvent.html">OS_WaitEvent*()</A></CODE>), control will return from this function immediately regardless of whether the event completion conditions are met. Thread functions are not called, so the system will not switch threads.</P>
71<P>The completion conditions are indicated by <B><I>pattern</I></B> and <B><I>mode</I></B>. For more information, see <CODE><A href="OS_WaitEvent.html">OS_WaitEvent*()</A></CODE>.</P>
72<P>Returns a nonzero event flag value if the completion conditions have been met, and returns 0 if the conditions have not been met.</P>
73<P>In <CODE>OS_PollEventEx()</CODE>, when the completion conditions have been met, the bits indicated in <B><I>clearBit</I></B> will be cleared from the event flag. The return value will be the value of the event flag before it is cleared.</P>
74<P><CODE>OS_PollEvent<FONT color="#ff0000">_And</FONT>( event, pattern )</CODE> is the same as <CODE>OS_PollEvent( event, pattern, <FONT color="#ff0000">OS_EVENT_MODE_AND</FONT> )</CODE>.</P>
75<P><CODE>OS_PollEvent<FONT color="#ff0000">_Or</FONT>( event, pattern )</CODE> is the same as <CODE>OS_PollEvent( event, pattern, <FONT color="#ff0000">OS_EVENT_MODE_OR</FONT> )</CODE>.</P>
76<P><CODE>OS_PollEventEx<FONT color="#ff0000">_And</FONT>( event, pattern, clearBit )</CODE> is the same as <CODE>OS_PollEventEx( event, pattern, <FONT color="#ff0000">OS_EVENT_MODE_AND</FONT>, clearBit )</CODE>.</P>
77<P><CODE>OS_PollEventEx<FONT color="#ff0000">_Or</FONT>( event, pattern, clearBit )</CODE> is the same as <CODE>OS_PollEventEx( event, pattern, <FONT color="#ff0000">OS_EVENT_MODE_OR</FONT>, clearBit )</CODE>.</P>
78<H2>See Also</H2>
79<P><CODE><A href="OS_InitEvent.html">OS_InitEvent</A>, <A href="OS_WaitEvent.html">OS_WaitEvent*</A>, <A href="OS_SignalEvent.html">OS_SignalEvent</A>, <A href="OS_ClearEvent.html">OS_Clear*Event</A>, <A href="about_Event.html">OS Overview (Events)</A><BR></CODE></P>
80<H2>Revision History</H2>
81<P>2007/12/04 Initial version.</P>
82<hr><p>CONFIDENTIAL</p></body>
83</HTML>