0
|
1 <HTML
|
|
2 ><HEAD
|
|
3 ><TITLE
|
|
4 >SDL_SemPost</TITLE
|
|
5 ><META
|
|
6 NAME="GENERATOR"
|
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.61
|
|
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_SemWaitTimeout"
|
|
17 HREF="sdlsemwaittimeout.html"><LINK
|
|
18 REL="NEXT"
|
|
19 TITLE="SDL_SemValue"
|
|
20 HREF="sdlsemvalue.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="sdlsemwaittimeout.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="sdlsemvalue.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="SDLSEMPOST"
|
|
71 >SDL_SemPost</A
|
|
72 ></H1
|
|
73 ><DIV
|
|
74 CLASS="REFNAMEDIV"
|
|
75 ><A
|
|
76 NAME="AEN7545"
|
|
77 ></A
|
|
78 ><H2
|
|
79 >Name</H2
|
|
80 >SDL_SemPost -- Unlock a semaphore.</DIV
|
|
81 ><DIV
|
|
82 CLASS="REFSYNOPSISDIV"
|
|
83 ><A
|
|
84 NAME="AEN7548"
|
|
85 ></A
|
|
86 ><H2
|
|
87 >Synopsis</H2
|
|
88 ><DIV
|
|
89 CLASS="FUNCSYNOPSIS"
|
|
90 ><A
|
|
91 NAME="AEN7549"
|
|
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_SemPost</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
|
|
116 NAME="AEN7555"
|
|
117 ></A
|
|
118 ><H2
|
|
119 >Description</H2
|
|
120 ><P
|
|
121 ><TT
|
|
122 CLASS="FUNCTION"
|
|
123 >SDL_SemPost</TT
|
|
124 > unlocks the semaphore pointed to by
|
|
125 <TT
|
|
126 CLASS="PARAMETER"
|
|
127 ><I
|
|
128 >sem</I
|
|
129 ></TT
|
|
130 > and atomically increments the semaphores value.
|
|
131 Threads that were blocking on the semaphore may be scheduled after this call
|
|
132 succeeds.</P
|
|
133 ><P
|
|
134 ><TT
|
|
135 CLASS="FUNCTION"
|
|
136 >SDL_SemPost</TT
|
|
137 > should be called after a semaphore is locked by a successful call to
|
|
138 <A
|
|
139 HREF="sdlsemwait.html"
|
|
140 >SDL_SemWait</A
|
|
141 >,
|
|
142 <A
|
|
143 HREF="sdlsemtrywait.html"
|
|
144 >SDL_SemTryWait</A
|
|
145 > or
|
|
146 <A
|
|
147 HREF="sdlsemwaittimeout.html"
|
|
148 >SDL_SemWaitTimeout</A
|
|
149 >.</P
|
|
150 ></DIV
|
|
151 ><DIV
|
|
152 CLASS="REFSECT1"
|
|
153 ><A
|
|
154 NAME="AEN7565"
|
|
155 ></A
|
|
156 ><H2
|
|
157 >Return Value</H2
|
|
158 ><P
|
|
159 >Returns <SPAN
|
|
160 CLASS="RETURNVALUE"
|
|
161 >0</SPAN
|
|
162 > if successful or
|
|
163 <SPAN
|
|
164 CLASS="RETURNVALUE"
|
|
165 >-1</SPAN
|
|
166 > if there was an error (leaving the semaphore unchanged).</P
|
|
167 ></DIV
|
|
168 ><DIV
|
|
169 CLASS="REFSECT1"
|
|
170 ><A
|
|
171 NAME="AEN7570"
|
|
172 ></A
|
|
173 ><H2
|
|
174 >Examples</H2
|
|
175 ><P
|
|
176 ><PRE
|
|
177 CLASS="PROGRAMLISTING"
|
|
178 >SDL_SemPost(my_sem);</PRE
|
|
179 ></P
|
|
180 ></DIV
|
|
181 ><DIV
|
|
182 CLASS="REFSECT1"
|
|
183 ><A
|
|
184 NAME="AEN7574"
|
|
185 ></A
|
|
186 ><H2
|
|
187 >See Also</H2
|
|
188 ><P
|
|
189 ><A
|
|
190 HREF="sdlcreatesemaphore.html"
|
|
191 ><TT
|
|
192 CLASS="FUNCTION"
|
|
193 >SDL_CreateSemaphore</TT
|
|
194 ></A
|
|
195 >,
|
|
196 <A
|
|
197 HREF="sdldestroysemaphore.html"
|
|
198 ><TT
|
|
199 CLASS="FUNCTION"
|
|
200 >SDL_DestroySemaphore</TT
|
|
201 ></A
|
|
202 >,
|
|
203 <A
|
|
204 HREF="sdlsemwait.html"
|
|
205 ><TT
|
|
206 CLASS="FUNCTION"
|
|
207 >SDL_SemWait</TT
|
|
208 ></A
|
|
209 >,
|
|
210 <A
|
|
211 HREF="sdlsemtrywait.html"
|
|
212 ><TT
|
|
213 CLASS="FUNCTION"
|
|
214 >SDL_SemTryWait</TT
|
|
215 ></A
|
|
216 >,
|
|
217 <A
|
|
218 HREF="sdlsemwaittimeout.html"
|
|
219 ><TT
|
|
220 CLASS="FUNCTION"
|
|
221 >SDL_SemWaitTimeout</TT
|
|
222 ></A
|
|
223 >,
|
|
224 <A
|
|
225 HREF="sdlsemvalue.html"
|
|
226 ><TT
|
|
227 CLASS="FUNCTION"
|
|
228 >SDL_SemValue</TT
|
|
229 ></A
|
|
230 ></P
|
|
231 ></DIV
|
|
232 ><DIV
|
|
233 CLASS="NAVFOOTER"
|
|
234 ><HR
|
|
235 ALIGN="LEFT"
|
|
236 WIDTH="100%"><TABLE
|
|
237 WIDTH="100%"
|
|
238 BORDER="0"
|
|
239 CELLPADDING="0"
|
|
240 CELLSPACING="0"
|
|
241 ><TR
|
|
242 ><TD
|
|
243 WIDTH="33%"
|
|
244 ALIGN="left"
|
|
245 VALIGN="top"
|
|
246 ><A
|
|
247 HREF="sdlsemwaittimeout.html"
|
|
248 >Prev</A
|
|
249 ></TD
|
|
250 ><TD
|
|
251 WIDTH="34%"
|
|
252 ALIGN="center"
|
|
253 VALIGN="top"
|
|
254 ><A
|
|
255 HREF="index.html"
|
|
256 >Home</A
|
|
257 ></TD
|
|
258 ><TD
|
|
259 WIDTH="33%"
|
|
260 ALIGN="right"
|
|
261 VALIGN="top"
|
|
262 ><A
|
|
263 HREF="sdlsemvalue.html"
|
|
264 >Next</A
|
|
265 ></TD
|
|
266 ></TR
|
|
267 ><TR
|
|
268 ><TD
|
|
269 WIDTH="33%"
|
|
270 ALIGN="left"
|
|
271 VALIGN="top"
|
|
272 >SDL_SemWaitTimeout</TD
|
|
273 ><TD
|
|
274 WIDTH="34%"
|
|
275 ALIGN="center"
|
|
276 VALIGN="top"
|
|
277 ><A
|
|
278 HREF="thread.html"
|
|
279 >Up</A
|
|
280 ></TD
|
|
281 ><TD
|
|
282 WIDTH="33%"
|
|
283 ALIGN="right"
|
|
284 VALIGN="top"
|
|
285 >SDL_SemValue</TD
|
|
286 ></TR
|
|
287 ></TABLE
|
|
288 ></DIV
|
|
289 ></BODY
|
|
290 ></HTML
|
|
291 > |