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 http-equiv="Content-Style-Type" content="text/css">
6<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
7<TITLE>OSWaitSemaphore</TITLE>
8</HEAD>
9<BODY>
10<H1>OSWaitSemaphore</H1>
11<H2>C Specification</H2>
12<DL>
13  <DD>
14  <PRE><CODE>#include &lt;revolution/os.h&gt;</CODE></PRE>
15  <DD>
16  <PRE><CODE>s32  OSWaitSemaphore( OSSemaphore* sem );</CODE></PRE>
17</DL>
18<H2>Arguments</H2>
19<TABLE border="1" cellpadding="3" cellspacing="0.1">
20  <TBODY>
21    <TR>
22<TD width="120" bgcolor="#ffffe8"><I><B><CODE><STRONG><EM><CODE>sem</CODE></EM></STRONG></CODE></B></I></TD>
23<TD width="520">Pointer to a semaphore.</TD>
24    </TR>
25  </TBODY>
26</TABLE>
27<H2>Return Values</H2>
28<P>The previous semaphore count.</P>
29<H2>Description</H2>
30<P>Decrements the specified semaphore count. If the semaphore count is less than zero, the calling thread blocks until it can decrement the semaphore count.</P>
31<P>This function may put the current thread to sleep. For precautions when calling similar functions, refer to <A href="../Interrupt/intro.html">Interrupts and Callback Functions</A>.</P>
32
33<H2>See Also</H2>
34<P>
35<A href="../toc.html#Thread" target="contents">Thread Functions</A>, <A href="../toc.html#ThreadSynchronization" target="contents">Thread Synchronization Functions</A>, <A href="../Interrupt/intro.html">Interrupts and Callback Functions</A>
36</P>
37<H2>Revision History</H2>
38<p>
392007/09/25 Added information on the sleeping status of threads.<br>2006/03/01 Initial version. <br>
40</p>
41<hr><p>CONFIDENTIAL</p></body>
42</HTML>