0
|
1 <HTML
|
|
2 ><HEAD
|
|
3 ><TITLE
|
|
4 >SDL_DestroySemaphore</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_CreateSemaphore"
|
|
17 HREF="sdlcreatesemaphore.html"><LINK
|
|
18 REL="NEXT"
|
|
19 TITLE="SDL_SemWait"
|
|
20 HREF="sdlsemwait.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="sdlcreatesemaphore.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="sdlsemwait.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="SDLDESTROYSEMAPHORE"
|
|
71 >SDL_DestroySemaphore</A
|
|
72 ></H1
|
|
73 ><DIV
|
|
74 CLASS="REFNAMEDIV"
|
|
75 ><A
|
|
76 NAME="AEN7357"
|
|
77 ></A
|
|
78 ><H2
|
|
79 >Name</H2
|
|
80 >SDL_DestroySemaphore -- Destroys a semaphore that was created by <A
|
|
81 HREF="sdlcreatesemaphore.html"
|
|
82 >SDL_CreateSemaphore</A
|
|
83 >.</DIV
|
|
84 ><DIV
|
|
85 CLASS="REFSYNOPSISDIV"
|
|
86 ><A
|
|
87 NAME="AEN7361"
|
|
88 ></A
|
|
89 ><H2
|
|
90 >Synopsis</H2
|
|
91 ><DIV
|
|
92 CLASS="FUNCSYNOPSIS"
|
|
93 ><A
|
|
94 NAME="AEN7362"
|
|
95 ></A
|
|
96 ><P
|
|
97 ></P
|
|
98 ><PRE
|
|
99 CLASS="FUNCSYNOPSISINFO"
|
|
100 >#include "SDL.h"
|
|
101 #include "SDL_thread.h"</PRE
|
|
102 ><P
|
|
103 ><CODE
|
|
104 ><CODE
|
|
105 CLASS="FUNCDEF"
|
|
106 >void <B
|
|
107 CLASS="FSFUNC"
|
|
108 >SDL_DestroySemaphore</B
|
|
109 ></CODE
|
|
110 >(SDL_sem *sem);</CODE
|
|
111 ></P
|
|
112 ><P
|
|
113 ></P
|
|
114 ></DIV
|
|
115 ></DIV
|
|
116 ><DIV
|
|
117 CLASS="REFSECT1"
|
|
118 ><A
|
|
119 NAME="AEN7368"
|
|
120 ></A
|
|
121 ><H2
|
|
122 >Description</H2
|
|
123 ><P
|
|
124 ><TT
|
|
125 CLASS="FUNCTION"
|
|
126 >SDL_DestroySemaphore</TT
|
|
127 > destroys the semaphore pointed to
|
|
128 by <TT
|
|
129 CLASS="PARAMETER"
|
|
130 ><I
|
|
131 >sem</I
|
|
132 ></TT
|
|
133 > that was created by
|
|
134 <A
|
|
135 HREF="sdlcreatesemaphore.html"
|
|
136 ><TT
|
|
137 CLASS="FUNCTION"
|
|
138 >SDL_CreateSemaphore</TT
|
|
139 ></A
|
|
140 >.
|
|
141 It is not safe to destroy a semaphore if there are threads currently blocked
|
|
142 waiting on it.</P
|
|
143 ></DIV
|
|
144 ><DIV
|
|
145 CLASS="REFSECT1"
|
|
146 ><A
|
|
147 NAME="AEN7375"
|
|
148 ></A
|
|
149 ><H2
|
|
150 >Examples</H2
|
|
151 ><P
|
|
152 ><PRE
|
|
153 CLASS="PROGRAMLISTING"
|
|
154 >if (my_sem != NULL) {
|
|
155 SDL_DestroySemaphore(my_sem);
|
|
156 my_sem = NULL;
|
|
157 }</PRE
|
|
158 ></P
|
|
159 ></DIV
|
|
160 ><DIV
|
|
161 CLASS="REFSECT1"
|
|
162 ><A
|
|
163 NAME="AEN7379"
|
|
164 ></A
|
|
165 ><H2
|
|
166 >See Also</H2
|
|
167 ><P
|
|
168 ><A
|
|
169 HREF="sdlcreatesemaphore.html"
|
|
170 ><TT
|
|
171 CLASS="FUNCTION"
|
|
172 >SDL_CreateSemaphore</TT
|
|
173 ></A
|
|
174 >,
|
|
175 <A
|
|
176 HREF="sdlsemwait.html"
|
|
177 ><TT
|
|
178 CLASS="FUNCTION"
|
|
179 >SDL_SemWait</TT
|
|
180 ></A
|
|
181 >,
|
|
182 <A
|
|
183 HREF="sdlsemtrywait.html"
|
|
184 ><TT
|
|
185 CLASS="FUNCTION"
|
|
186 >SDL_SemTryWait</TT
|
|
187 ></A
|
|
188 >,
|
|
189 <A
|
|
190 HREF="sdlsemwaittimeout.html"
|
|
191 ><TT
|
|
192 CLASS="FUNCTION"
|
|
193 >SDL_SemWaitTimeout</TT
|
|
194 ></A
|
|
195 >,
|
|
196 <A
|
|
197 HREF="sdlsempost.html"
|
|
198 ><TT
|
|
199 CLASS="FUNCTION"
|
|
200 >SDL_SemPost</TT
|
|
201 ></A
|
|
202 >,
|
|
203 <A
|
|
204 HREF="sdlsemvalue.html"
|
|
205 ><TT
|
|
206 CLASS="FUNCTION"
|
|
207 >SDL_SemValue</TT
|
|
208 ></A
|
|
209 ></P
|
|
210 ></DIV
|
|
211 ><DIV
|
|
212 CLASS="NAVFOOTER"
|
|
213 ><HR
|
|
214 ALIGN="LEFT"
|
|
215 WIDTH="100%"><TABLE
|
|
216 WIDTH="100%"
|
|
217 BORDER="0"
|
|
218 CELLPADDING="0"
|
|
219 CELLSPACING="0"
|
|
220 ><TR
|
|
221 ><TD
|
|
222 WIDTH="33%"
|
|
223 ALIGN="left"
|
|
224 VALIGN="top"
|
|
225 ><A
|
|
226 HREF="sdlcreatesemaphore.html"
|
|
227 >Prev</A
|
|
228 ></TD
|
|
229 ><TD
|
|
230 WIDTH="34%"
|
|
231 ALIGN="center"
|
|
232 VALIGN="top"
|
|
233 ><A
|
|
234 HREF="index.html"
|
|
235 >Home</A
|
|
236 ></TD
|
|
237 ><TD
|
|
238 WIDTH="33%"
|
|
239 ALIGN="right"
|
|
240 VALIGN="top"
|
|
241 ><A
|
|
242 HREF="sdlsemwait.html"
|
|
243 >Next</A
|
|
244 ></TD
|
|
245 ></TR
|
|
246 ><TR
|
|
247 ><TD
|
|
248 WIDTH="33%"
|
|
249 ALIGN="left"
|
|
250 VALIGN="top"
|
|
251 >SDL_CreateSemaphore</TD
|
|
252 ><TD
|
|
253 WIDTH="34%"
|
|
254 ALIGN="center"
|
|
255 VALIGN="top"
|
|
256 ><A
|
|
257 HREF="thread.html"
|
|
258 >Up</A
|
|
259 ></TD
|
|
260 ><TD
|
|
261 WIDTH="33%"
|
|
262 ALIGN="right"
|
|
263 VALIGN="top"
|
|
264 >SDL_SemWait</TD
|
|
265 ></TR
|
|
266 ></TABLE
|
|
267 ></DIV
|
|
268 ></BODY
|
|
269 ></HTML
|
|
270 > |