Mercurial > sdl-ios-xcode
annotate docs/html/sdlsemwait.html @ 537:77b05010bb33
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 09 Nov 2002 05:51:13 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_SemWait</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Multi-threaded Programming" | |
14 HREF="thread.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_DestroySemaphore" | |
17 HREF="sdldestroysemaphore.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_SemTryWait" | |
20 HREF="sdlsemtrywait.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdldestroysemaphore.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="sdlsemtrywait.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLSEMWAIT" | |
71 >SDL_SemWait</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN7635" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_SemWait -- Lock a semaphore and suspend the thread if the semaphore value is zero.</DIV | |
81 ><DIV | |
82 CLASS="REFSYNOPSISDIV" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN7638" |
0 | 85 ></A |
86 ><H2 | |
87 >Synopsis</H2 | |
88 ><DIV | |
89 CLASS="FUNCSYNOPSIS" | |
90 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
91 NAME="AEN7639" |
0 | 92 ></A |
93 ><P | |
94 ></P | |
95 ><PRE | |
96 CLASS="FUNCSYNOPSISINFO" | |
97 >#include "SDL.h" | |
98 #include "SDL_thread.h"</PRE | |
99 ><P | |
100 ><CODE | |
101 ><CODE | |
102 CLASS="FUNCDEF" | |
103 >int <B | |
104 CLASS="FSFUNC" | |
105 >SDL_SemWait</B | |
106 ></CODE | |
107 >(SDL_sem *sem);</CODE | |
108 ></P | |
109 ><P | |
110 ></P | |
111 ></DIV | |
112 ></DIV | |
113 ><DIV | |
114 CLASS="REFSECT1" | |
115 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
116 NAME="AEN7645" |
0 | 117 ></A |
118 ><H2 | |
119 >Description</H2 | |
120 ><P | |
121 ><TT | |
122 CLASS="FUNCTION" | |
123 >SDL_SemWait()</TT | |
124 > suspends the calling thread until either | |
125 the semaphore pointed to by <TT | |
126 CLASS="PARAMETER" | |
127 ><I | |
128 >sem</I | |
129 ></TT | |
130 > has a positive value, | |
131 the call is interrupted by a signal or error. If the call is successful it | |
132 will atomically decrement the semaphore value.</P | |
133 ><P | |
134 >After <TT | |
135 CLASS="FUNCTION" | |
136 >SDL_SemWait()</TT | |
137 > is successful, the semaphore | |
138 can be released and its count atomically incremented by a successful call to | |
139 <A | |
140 HREF="sdlsempost.html" | |
141 >SDL_SemPost</A | |
142 >.</P | |
143 ></DIV | |
144 ><DIV | |
145 CLASS="REFSECT1" | |
146 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
147 NAME="AEN7653" |
0 | 148 ></A |
149 ><H2 | |
150 >Return Value</H2 | |
151 ><P | |
152 >Returns <SPAN | |
153 CLASS="RETURNVALUE" | |
154 >0</SPAN | |
155 > if successful or | |
156 <SPAN | |
157 CLASS="RETURNVALUE" | |
158 >-1</SPAN | |
159 > if there was an error (leaving the semaphore unchanged).</P | |
160 ></DIV | |
161 ><DIV | |
162 CLASS="REFSECT1" | |
163 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
164 NAME="AEN7658" |
0 | 165 ></A |
166 ><H2 | |
167 >Examples</H2 | |
168 ><P | |
169 ><PRE | |
170 CLASS="PROGRAMLISTING" | |
171 >if (SDL_SemWait(my_sem) == -1) { | |
172 return WAIT_FAILED; | |
173 } | |
174 | |
175 ... | |
176 | |
177 SDL_SemPost(my_sem);</PRE | |
178 ></P | |
179 ></DIV | |
180 ><DIV | |
181 CLASS="REFSECT1" | |
182 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
183 NAME="AEN7662" |
0 | 184 ></A |
185 ><H2 | |
186 >See Also</H2 | |
187 ><P | |
188 ><A | |
189 HREF="sdlcreatesemaphore.html" | |
190 ><TT | |
191 CLASS="FUNCTION" | |
192 >SDL_CreateSemaphore</TT | |
193 ></A | |
194 >, | |
195 <A | |
196 HREF="sdldestroysemaphore.html" | |
197 ><TT | |
198 CLASS="FUNCTION" | |
199 >SDL_DestroySemaphore</TT | |
200 ></A | |
201 >, | |
202 <A | |
203 HREF="sdlsemtrywait.html" | |
204 ><TT | |
205 CLASS="FUNCTION" | |
206 >SDL_SemTryWait</TT | |
207 ></A | |
208 >, | |
209 <A | |
210 HREF="sdlsemwaittimeout.html" | |
211 ><TT | |
212 CLASS="FUNCTION" | |
213 >SDL_SemWaitTimeout</TT | |
214 ></A | |
215 >, | |
216 <A | |
217 HREF="sdlsempost.html" | |
218 ><TT | |
219 CLASS="FUNCTION" | |
220 >SDL_SemPost</TT | |
221 ></A | |
222 >, | |
223 <A | |
224 HREF="sdlsemvalue.html" | |
225 ><TT | |
226 CLASS="FUNCTION" | |
227 >SDL_SemValue</TT | |
228 ></A | |
229 ></P | |
230 ></DIV | |
231 ><DIV | |
232 CLASS="NAVFOOTER" | |
233 ><HR | |
234 ALIGN="LEFT" | |
235 WIDTH="100%"><TABLE | |
236 WIDTH="100%" | |
237 BORDER="0" | |
238 CELLPADDING="0" | |
239 CELLSPACING="0" | |
240 ><TR | |
241 ><TD | |
242 WIDTH="33%" | |
243 ALIGN="left" | |
244 VALIGN="top" | |
245 ><A | |
246 HREF="sdldestroysemaphore.html" | |
247 >Prev</A | |
248 ></TD | |
249 ><TD | |
250 WIDTH="34%" | |
251 ALIGN="center" | |
252 VALIGN="top" | |
253 ><A | |
254 HREF="index.html" | |
255 >Home</A | |
256 ></TD | |
257 ><TD | |
258 WIDTH="33%" | |
259 ALIGN="right" | |
260 VALIGN="top" | |
261 ><A | |
262 HREF="sdlsemtrywait.html" | |
263 >Next</A | |
264 ></TD | |
265 ></TR | |
266 ><TR | |
267 ><TD | |
268 WIDTH="33%" | |
269 ALIGN="left" | |
270 VALIGN="top" | |
271 >SDL_DestroySemaphore</TD | |
272 ><TD | |
273 WIDTH="34%" | |
274 ALIGN="center" | |
275 VALIGN="top" | |
276 ><A | |
277 HREF="thread.html" | |
278 >Up</A | |
279 ></TD | |
280 ><TD | |
281 WIDTH="33%" | |
282 ALIGN="right" | |
283 VALIGN="top" | |
284 >SDL_SemTryWait</TD | |
285 ></TR | |
286 ></TABLE | |
287 ></DIV | |
288 ></BODY | |
289 ></HTML | |
290 > |