Mercurial > sdl-ios-xcode
annotate docs/html/sdlcreatesemaphore.html @ 302:8a86bdf34f0f
Added Atari joystick support (thanks Patrice!)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 07 Mar 2002 20:23:11 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CreateSemaphore</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_mutexV" | |
17 HREF="sdlmutexv.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_DestroySemaphore" | |
20 HREF="sdldestroysemaphore.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="sdlmutexv.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="sdldestroysemaphore.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="SDLCREATESEMAPHORE" | |
71 >SDL_CreateSemaphore</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="AEN7548" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_CreateSemaphore -- Creates a new semaphore and assigns an initial value to it.</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="AEN7551" |
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="AEN7552" |
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 >SDL_sem *<B | |
104 CLASS="FSFUNC" | |
105 >SDL_CreateSemaphore</B | |
106 ></CODE | |
107 >(Uint32 initial_value);</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="AEN7558" |
0 | 117 ></A |
118 ><H2 | |
119 >Description</H2 | |
120 ><P | |
121 ><TT | |
122 CLASS="FUNCTION" | |
123 >SDL_CreateSemaphore()</TT | |
124 > creates a new semaphore and | |
125 initializes it with the value <TT | |
126 CLASS="PARAMETER" | |
127 ><I | |
128 >initial_value</I | |
129 ></TT | |
130 >. | |
131 Each locking operation on the semaphore by | |
132 <A | |
133 HREF="sdlsemwait.html" | |
134 >SDL_SemWait</A | |
135 >, | |
136 <A | |
137 HREF="sdlsemtrywait.html" | |
138 >SDL_SemTryWait</A | |
139 > or | |
140 <A | |
141 HREF="sdlsemwaittimeout.html" | |
142 >SDL_SemWaitTimeout</A | |
143 > | |
144 will atomically decrement the semaphore value. The locking operation will be blocked | |
145 if the semaphore value is not positive (greater than zero). Each unlock operation by | |
146 <A | |
147 HREF="sdlsempost.html" | |
148 >SDL_SemPost</A | |
149 > | |
150 will atomically increment the semaphore value.</P | |
151 ></DIV | |
152 ><DIV | |
153 CLASS="REFSECT1" | |
154 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
155 NAME="AEN7567" |
0 | 156 ></A |
157 ><H2 | |
158 >Return Value</H2 | |
159 ><P | |
160 >Returns a pointer to an initialized semaphore or | |
161 <SPAN | |
162 CLASS="RETURNVALUE" | |
163 >NULL</SPAN | |
164 > if there was an error.</P | |
165 ></DIV | |
166 ><DIV | |
167 CLASS="REFSECT1" | |
168 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
169 NAME="AEN7571" |
0 | 170 ></A |
171 ><H2 | |
172 >Examples</H2 | |
173 ><P | |
174 ><PRE | |
175 CLASS="PROGRAMLISTING" | |
176 >SDL_sem *my_sem; | |
177 | |
178 my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE); | |
179 | |
180 if (my_sem == NULL) { | |
181 return CREATE_SEM_FAILED; | |
182 }</PRE | |
183 ></P | |
184 ></DIV | |
185 ><DIV | |
186 CLASS="REFSECT1" | |
187 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
188 NAME="AEN7575" |
0 | 189 ></A |
190 ><H2 | |
191 >See Also</H2 | |
192 ><P | |
193 ><A | |
194 HREF="sdldestroysemaphore.html" | |
195 ><TT | |
196 CLASS="FUNCTION" | |
197 >SDL_DestroySemaphore</TT | |
198 ></A | |
199 >, | |
200 <A | |
201 HREF="sdlsemwait.html" | |
202 ><TT | |
203 CLASS="FUNCTION" | |
204 >SDL_SemWait</TT | |
205 ></A | |
206 >, | |
207 <A | |
208 HREF="sdlsemtrywait.html" | |
209 ><TT | |
210 CLASS="FUNCTION" | |
211 >SDL_SemTryWait</TT | |
212 ></A | |
213 >, | |
214 <A | |
215 HREF="sdlsemwaittimeout.html" | |
216 ><TT | |
217 CLASS="FUNCTION" | |
218 >SDL_SemWaitTimeout</TT | |
219 ></A | |
220 >, | |
221 <A | |
222 HREF="sdlsempost.html" | |
223 ><TT | |
224 CLASS="FUNCTION" | |
225 >SDL_SemPost</TT | |
226 ></A | |
227 >, | |
228 <A | |
229 HREF="sdlsemvalue.html" | |
230 ><TT | |
231 CLASS="FUNCTION" | |
232 >SDL_SemValue</TT | |
233 ></A | |
234 ></P | |
235 ></DIV | |
236 ><DIV | |
237 CLASS="NAVFOOTER" | |
238 ><HR | |
239 ALIGN="LEFT" | |
240 WIDTH="100%"><TABLE | |
241 WIDTH="100%" | |
242 BORDER="0" | |
243 CELLPADDING="0" | |
244 CELLSPACING="0" | |
245 ><TR | |
246 ><TD | |
247 WIDTH="33%" | |
248 ALIGN="left" | |
249 VALIGN="top" | |
250 ><A | |
251 HREF="sdlmutexv.html" | |
252 >Prev</A | |
253 ></TD | |
254 ><TD | |
255 WIDTH="34%" | |
256 ALIGN="center" | |
257 VALIGN="top" | |
258 ><A | |
259 HREF="index.html" | |
260 >Home</A | |
261 ></TD | |
262 ><TD | |
263 WIDTH="33%" | |
264 ALIGN="right" | |
265 VALIGN="top" | |
266 ><A | |
267 HREF="sdldestroysemaphore.html" | |
268 >Next</A | |
269 ></TD | |
270 ></TR | |
271 ><TR | |
272 ><TD | |
273 WIDTH="33%" | |
274 ALIGN="left" | |
275 VALIGN="top" | |
276 >SDL_mutexV</TD | |
277 ><TD | |
278 WIDTH="34%" | |
279 ALIGN="center" | |
280 VALIGN="top" | |
281 ><A | |
282 HREF="thread.html" | |
283 >Up</A | |
284 ></TD | |
285 ><TD | |
286 WIDTH="33%" | |
287 ALIGN="right" | |
288 VALIGN="top" | |
289 >SDL_DestroySemaphore</TD | |
290 ></TR | |
291 ></TABLE | |
292 ></DIV | |
293 ></BODY | |
294 ></HTML | |
295 > |