comparison docs/html/sdlsemtrywait.html @ 803:355632dca928

Updated SDL HTML documentation
author Sam Lantinga <slouken@libsdl.org>
date Tue, 10 Feb 2004 15:15:40 +0000
parents e5bc29de3f0a
children
comparison
equal deleted inserted replaced
802:3c609d54f100 803:355632dca928
2 ><HEAD 2 ><HEAD
3 ><TITLE 3 ><TITLE
4 >SDL_SemTryWait</TITLE 4 >SDL_SemTryWait</TITLE
5 ><META 5 ><META
6 NAME="GENERATOR" 6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
8 "><LINK 8 "><LINK
9 REL="HOME" 9 REL="HOME"
10 TITLE="SDL Library Documentation" 10 TITLE="SDL Library Documentation"
11 HREF="index.html"><LINK 11 HREF="index.html"><LINK
12 REL="UP" 12 REL="UP"
26 VLINK="#551a8b" 26 VLINK="#551a8b"
27 ALINK="#ff0000" 27 ALINK="#ff0000"
28 ><DIV 28 ><DIV
29 CLASS="NAVHEADER" 29 CLASS="NAVHEADER"
30 ><TABLE 30 ><TABLE
31 SUMMARY="Header navigation table"
31 WIDTH="100%" 32 WIDTH="100%"
32 BORDER="0" 33 BORDER="0"
33 CELLPADDING="0" 34 CELLPADDING="0"
34 CELLSPACING="0" 35 CELLSPACING="0"
35 ><TR 36 ><TR
43 WIDTH="10%" 44 WIDTH="10%"
44 ALIGN="left" 45 ALIGN="left"
45 VALIGN="bottom" 46 VALIGN="bottom"
46 ><A 47 ><A
47 HREF="sdlsemwait.html" 48 HREF="sdlsemwait.html"
49 ACCESSKEY="P"
48 >Prev</A 50 >Prev</A
49 ></TD 51 ></TD
50 ><TD 52 ><TD
51 WIDTH="80%" 53 WIDTH="80%"
52 ALIGN="center" 54 ALIGN="center"
56 WIDTH="10%" 58 WIDTH="10%"
57 ALIGN="right" 59 ALIGN="right"
58 VALIGN="bottom" 60 VALIGN="bottom"
59 ><A 61 ><A
60 HREF="sdlsemwaittimeout.html" 62 HREF="sdlsemwaittimeout.html"
63 ACCESSKEY="N"
61 >Next</A 64 >Next</A
62 ></TD 65 ></TD
63 ></TR 66 ></TR
64 ></TABLE 67 ></TABLE
65 ><HR 68 ><HR
66 ALIGN="LEFT" 69 ALIGN="LEFT"
67 WIDTH="100%"></DIV 70 WIDTH="100%"></DIV
68 ><H1 71 ><H1
69 ><A 72 ><A
70 NAME="SDLSEMTRYWAIT" 73 NAME="SDLSEMTRYWAIT"
71 >SDL_SemTryWait</A 74 ></A
72 ></H1 75 >SDL_SemTryWait</H1
73 ><DIV 76 ><DIV
74 CLASS="REFNAMEDIV" 77 CLASS="REFNAMEDIV"
75 ><A 78 ><A
76 NAME="AEN7681" 79 NAME="AEN8069"
77 ></A 80 ></A
78 ><H2 81 ><H2
79 >Name</H2 82 >Name</H2
80 >SDL_SemTryWait&nbsp;--&nbsp;Attempt to lock a semaphore but don't suspend the thread.</DIV 83 >SDL_SemTryWait&nbsp;--&nbsp;Attempt to lock a semaphore but don't suspend the thread.</DIV
81 ><DIV 84 ><DIV
82 CLASS="REFSYNOPSISDIV" 85 CLASS="REFSYNOPSISDIV"
83 ><A 86 ><A
84 NAME="AEN7684" 87 NAME="AEN8072"
85 ></A 88 ></A
86 ><H2 89 ><H2
87 >Synopsis</H2 90 >Synopsis</H2
88 ><DIV 91 ><DIV
89 CLASS="FUNCSYNOPSIS" 92 CLASS="FUNCSYNOPSIS"
90 ><A 93 ><A
91 NAME="AEN7685" 94 NAME="AEN8073"
92 ></A 95 ></A
93 ><P 96 ><P
94 ></P 97 ></P
95 ><PRE 98 ><PRE
96 CLASS="FUNCSYNOPSISINFO" 99 CLASS="FUNCSYNOPSISINFO"
111 ></DIV 114 ></DIV
112 ></DIV 115 ></DIV
113 ><DIV 116 ><DIV
114 CLASS="REFSECT1" 117 CLASS="REFSECT1"
115 ><A 118 ><A
116 NAME="AEN7691" 119 NAME="AEN8079"
117 ></A 120 ></A
118 ><H2 121 ><H2
119 >Description</H2 122 >Description</H2
120 ><P 123 ><P
121 ><TT 124 ><TT
136 ></TT 139 ></TT
137 > is positive it will atomically 140 > is positive it will atomically
138 decrement the semaphore value and return 0, otherwise it will return 141 decrement the semaphore value and return 0, otherwise it will return
139 <SPAN 142 <SPAN
140 CLASS="RETURNVALUE" 143 CLASS="RETURNVALUE"
141 >SDL_MUTEX_TIMEOUT</SPAN 144 >SDL_MUTEX_TIMEDOUT</SPAN
142 > instead of suspending the thread.</P 145 > instead of suspending the thread.</P
143 ><P 146 ><P
144 >After <TT 147 >After <TT
145 CLASS="FUNCTION" 148 CLASS="FUNCTION"
146 >SDL_SemTryWait</TT 149 >SDL_SemTryWait</TT
152 >.</P 155 >.</P
153 ></DIV 156 ></DIV
154 ><DIV 157 ><DIV
155 CLASS="REFSECT1" 158 CLASS="REFSECT1"
156 ><A 159 ><A
157 NAME="AEN7702" 160 NAME="AEN8090"
158 ></A 161 ></A
159 ><H2 162 ><H2
160 >Return Value</H2 163 >Return Value</H2
161 ><P 164 ><P
162 >Returns <SPAN 165 >Returns <SPAN
163 CLASS="RETURNVALUE" 166 CLASS="RETURNVALUE"
164 >0</SPAN 167 >0</SPAN
165 > if the semaphore was successfully locked or 168 > if the semaphore was successfully locked or
166 either <SPAN 169 either <SPAN
167 CLASS="RETURNVALUE" 170 CLASS="RETURNVALUE"
168 >SDL_MUTEX_TIMEOUT</SPAN 171 >SDL_MUTEX_TIMEDOUT</SPAN
169 > or <SPAN 172 > or <SPAN
170 CLASS="RETURNVALUE" 173 CLASS="RETURNVALUE"
171 >-1</SPAN 174 >-1</SPAN
172 > 175 >
173 if the thread would have suspended or there was an error, respectivly.</P 176 if the thread would have suspended or there was an error, respectivly.</P
175 >If the semaphore was not successfully locked, the semaphore will be unchanged.</P 178 >If the semaphore was not successfully locked, the semaphore will be unchanged.</P
176 ></DIV 179 ></DIV
177 ><DIV 180 ><DIV
178 CLASS="REFSECT1" 181 CLASS="REFSECT1"
179 ><A 182 ><A
180 NAME="AEN7709" 183 NAME="AEN8097"
181 ></A 184 ></A
182 ><H2 185 ><H2
183 >Examples</H2 186 >Examples</H2
184 ><P 187 ><P
185 ><PRE 188 ><PRE
186 CLASS="PROGRAMLISTING" 189 CLASS="PROGRAMLISTING"
187 >res = SDL_SemTryWait(my_sem); 190 >res = SDL_SemTryWait(my_sem);
188 191
189 if (res == SDL_MUTEX_TIMEOUT) { 192 if (res == SDL_MUTEX_TIMEDOUT) {
190 return TRY_AGAIN; 193 return TRY_AGAIN;
191 } 194 }
192 if (res == -1) { 195 if (res == -1) {
193 return WAIT_ERROR; 196 return WAIT_ERROR;
194 } 197 }
199 ></P 202 ></P
200 ></DIV 203 ></DIV
201 ><DIV 204 ><DIV
202 CLASS="REFSECT1" 205 CLASS="REFSECT1"
203 ><A 206 ><A
204 NAME="AEN7713" 207 NAME="AEN8101"
205 ></A 208 ></A
206 ><H2 209 ><H2
207 >See Also</H2 210 >See Also</H2
208 ><P 211 ><P
209 ><A 212 ><A
252 ><DIV 255 ><DIV
253 CLASS="NAVFOOTER" 256 CLASS="NAVFOOTER"
254 ><HR 257 ><HR
255 ALIGN="LEFT" 258 ALIGN="LEFT"
256 WIDTH="100%"><TABLE 259 WIDTH="100%"><TABLE
260 SUMMARY="Footer navigation table"
257 WIDTH="100%" 261 WIDTH="100%"
258 BORDER="0" 262 BORDER="0"
259 CELLPADDING="0" 263 CELLPADDING="0"
260 CELLSPACING="0" 264 CELLSPACING="0"
261 ><TR 265 ><TR
263 WIDTH="33%" 267 WIDTH="33%"
264 ALIGN="left" 268 ALIGN="left"
265 VALIGN="top" 269 VALIGN="top"
266 ><A 270 ><A
267 HREF="sdlsemwait.html" 271 HREF="sdlsemwait.html"
272 ACCESSKEY="P"
268 >Prev</A 273 >Prev</A
269 ></TD 274 ></TD
270 ><TD 275 ><TD
271 WIDTH="34%" 276 WIDTH="34%"
272 ALIGN="center" 277 ALIGN="center"
273 VALIGN="top" 278 VALIGN="top"
274 ><A 279 ><A
275 HREF="index.html" 280 HREF="index.html"
281 ACCESSKEY="H"
276 >Home</A 282 >Home</A
277 ></TD 283 ></TD
278 ><TD 284 ><TD
279 WIDTH="33%" 285 WIDTH="33%"
280 ALIGN="right" 286 ALIGN="right"
281 VALIGN="top" 287 VALIGN="top"
282 ><A 288 ><A
283 HREF="sdlsemwaittimeout.html" 289 HREF="sdlsemwaittimeout.html"
290 ACCESSKEY="N"
284 >Next</A 291 >Next</A
285 ></TD 292 ></TD
286 ></TR 293 ></TR
287 ><TR 294 ><TR
288 ><TD 295 ><TD
294 WIDTH="34%" 301 WIDTH="34%"
295 ALIGN="center" 302 ALIGN="center"
296 VALIGN="top" 303 VALIGN="top"
297 ><A 304 ><A
298 HREF="thread.html" 305 HREF="thread.html"
306 ACCESSKEY="U"
299 >Up</A 307 >Up</A
300 ></TD 308 ></TD
301 ><TD 309 ><TD
302 WIDTH="33%" 310 WIDTH="33%"
303 ALIGN="right" 311 ALIGN="right"