Mercurial > sdl-ios-xcode
annotate docs/html/sdldestroysemaphore.html @ 968:4675910b0b7b
Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
From: Hannu Savolainen
Subject: Re: SDL uses obsolete OSS features
I did some work on getting OSS to work better with SDL. There have been
some problems with select which should be fixed now.
I'm having some problems in understanding what is the purpose of the
DSP_WaitAudio() routine. I added a return to the very beginning of this
routine and commendted out the define for USE_BLOCKING_WRITES. At least
lbreakout2 seems to work as well as earlier. The latencies are the same.
An ordinary blocking write does exactly the same thing than DSP_WaitAudio
does. So I would recommend using the USE_BLOCKING_WRITES approach and
removing everything from the DSP_WaitAudio routine. Also enabling
USE_BLOCKING_WRITES makes it possible to simplify DSP_PlayAudio() because
you don't need to handle the partial writes (the do-while loop).
Attached is a patch against SDL-1.2.7. After these changes SDL will use
OSS as it's designed to be used (make it as simple as possible). This code
should work with all OSS implementations because it uses only the very
fundamental features that have been there since the jurassic times.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 12 Nov 2004 21:39:04 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_DestroySemaphore</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
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_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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlcreatesemaphore.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlsemwait.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLDESTROYSEMAPHORE" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_DestroySemaphore</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN7982" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_DestroySemaphore -- Destroys a semaphore that was created by <A | |
84 HREF="sdlcreatesemaphore.html" | |
85 >SDL_CreateSemaphore</A | |
86 >.</DIV | |
87 ><DIV | |
88 CLASS="REFSYNOPSISDIV" | |
89 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
90 NAME="AEN7986" |
0 | 91 ></A |
92 ><H2 | |
93 >Synopsis</H2 | |
94 ><DIV | |
95 CLASS="FUNCSYNOPSIS" | |
96 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
97 NAME="AEN7987" |
0 | 98 ></A |
99 ><P | |
100 ></P | |
101 ><PRE | |
102 CLASS="FUNCSYNOPSISINFO" | |
103 >#include "SDL.h" | |
104 #include "SDL_thread.h"</PRE | |
105 ><P | |
106 ><CODE | |
107 ><CODE | |
108 CLASS="FUNCDEF" | |
109 >void <B | |
110 CLASS="FSFUNC" | |
111 >SDL_DestroySemaphore</B | |
112 ></CODE | |
113 >(SDL_sem *sem);</CODE | |
114 ></P | |
115 ><P | |
116 ></P | |
117 ></DIV | |
118 ></DIV | |
119 ><DIV | |
120 CLASS="REFSECT1" | |
121 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
122 NAME="AEN7993" |
0 | 123 ></A |
124 ><H2 | |
125 >Description</H2 | |
126 ><P | |
127 ><TT | |
128 CLASS="FUNCTION" | |
129 >SDL_DestroySemaphore</TT | |
130 > destroys the semaphore pointed to | |
131 by <TT | |
132 CLASS="PARAMETER" | |
133 ><I | |
134 >sem</I | |
135 ></TT | |
136 > that was created by | |
137 <A | |
138 HREF="sdlcreatesemaphore.html" | |
139 ><TT | |
140 CLASS="FUNCTION" | |
141 >SDL_CreateSemaphore</TT | |
142 ></A | |
143 >. | |
144 It is not safe to destroy a semaphore if there are threads currently blocked | |
145 waiting on it.</P | |
146 ></DIV | |
147 ><DIV | |
148 CLASS="REFSECT1" | |
149 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
150 NAME="AEN8000" |
0 | 151 ></A |
152 ><H2 | |
153 >Examples</H2 | |
154 ><P | |
155 ><PRE | |
156 CLASS="PROGRAMLISTING" | |
157 >if (my_sem != NULL) { | |
158 SDL_DestroySemaphore(my_sem); | |
159 my_sem = NULL; | |
160 }</PRE | |
161 ></P | |
162 ></DIV | |
163 ><DIV | |
164 CLASS="REFSECT1" | |
165 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
166 NAME="AEN8004" |
0 | 167 ></A |
168 ><H2 | |
169 >See Also</H2 | |
170 ><P | |
171 ><A | |
172 HREF="sdlcreatesemaphore.html" | |
173 ><TT | |
174 CLASS="FUNCTION" | |
175 >SDL_CreateSemaphore</TT | |
176 ></A | |
177 >, | |
178 <A | |
179 HREF="sdlsemwait.html" | |
180 ><TT | |
181 CLASS="FUNCTION" | |
182 >SDL_SemWait</TT | |
183 ></A | |
184 >, | |
185 <A | |
186 HREF="sdlsemtrywait.html" | |
187 ><TT | |
188 CLASS="FUNCTION" | |
189 >SDL_SemTryWait</TT | |
190 ></A | |
191 >, | |
192 <A | |
193 HREF="sdlsemwaittimeout.html" | |
194 ><TT | |
195 CLASS="FUNCTION" | |
196 >SDL_SemWaitTimeout</TT | |
197 ></A | |
198 >, | |
199 <A | |
200 HREF="sdlsempost.html" | |
201 ><TT | |
202 CLASS="FUNCTION" | |
203 >SDL_SemPost</TT | |
204 ></A | |
205 >, | |
206 <A | |
207 HREF="sdlsemvalue.html" | |
208 ><TT | |
209 CLASS="FUNCTION" | |
210 >SDL_SemValue</TT | |
211 ></A | |
212 ></P | |
213 ></DIV | |
214 ><DIV | |
215 CLASS="NAVFOOTER" | |
216 ><HR | |
217 ALIGN="LEFT" | |
218 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
219 SUMMARY="Footer navigation table" |
0 | 220 WIDTH="100%" |
221 BORDER="0" | |
222 CELLPADDING="0" | |
223 CELLSPACING="0" | |
224 ><TR | |
225 ><TD | |
226 WIDTH="33%" | |
227 ALIGN="left" | |
228 VALIGN="top" | |
229 ><A | |
230 HREF="sdlcreatesemaphore.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
231 ACCESSKEY="P" |
0 | 232 >Prev</A |
233 ></TD | |
234 ><TD | |
235 WIDTH="34%" | |
236 ALIGN="center" | |
237 VALIGN="top" | |
238 ><A | |
239 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
240 ACCESSKEY="H" |
0 | 241 >Home</A |
242 ></TD | |
243 ><TD | |
244 WIDTH="33%" | |
245 ALIGN="right" | |
246 VALIGN="top" | |
247 ><A | |
248 HREF="sdlsemwait.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
249 ACCESSKEY="N" |
0 | 250 >Next</A |
251 ></TD | |
252 ></TR | |
253 ><TR | |
254 ><TD | |
255 WIDTH="33%" | |
256 ALIGN="left" | |
257 VALIGN="top" | |
258 >SDL_CreateSemaphore</TD | |
259 ><TD | |
260 WIDTH="34%" | |
261 ALIGN="center" | |
262 VALIGN="top" | |
263 ><A | |
264 HREF="thread.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
265 ACCESSKEY="U" |
0 | 266 >Up</A |
267 ></TD | |
268 ><TD | |
269 WIDTH="33%" | |
270 ALIGN="right" | |
271 VALIGN="top" | |
272 >SDL_SemWait</TD | |
273 ></TR | |
274 ></TABLE | |
275 ></DIV | |
276 ></BODY | |
277 ></HTML | |
278 > |