Mercurial > sdl-ios-xcode
annotate docs/html/sdlcondwaittimeout.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_CondWaitTimeout</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_CondWait" | |
17 HREF="sdlcondwait.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Time" | |
20 HREF="time.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="sdlcondwait.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="time.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="SDLCONDWAITTIMEOUT" | |
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_CondWaitTimeout</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="AEN8393" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CondWaitTimeout -- Wait on a condition variable, with timeout</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN8396" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN8397" |
0 | 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 >int <B | |
107 CLASS="FSFUNC" | |
108 >SDL_CondWaitTimeout</B | |
109 ></CODE | |
110 >(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);</CODE | |
111 ></P | |
112 ><P | |
113 ></P | |
114 ></DIV | |
115 ></DIV | |
116 ><DIV | |
117 CLASS="REFSECT1" | |
118 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
119 NAME="AEN8403" |
0 | 120 ></A |
121 ><H2 | |
122 >Description</H2 | |
123 ><P | |
124 >Wait on the condition variable <TT | |
125 CLASS="PARAMETER" | |
126 ><I | |
127 >cond</I | |
128 ></TT | |
129 > for, at most, <TT | |
130 CLASS="PARAMETER" | |
131 ><I | |
132 >ms</I | |
133 ></TT | |
134 > milliseconds. <TT | |
135 CLASS="PARAMETER" | |
136 ><I | |
137 >mut</I | |
138 ></TT | |
139 > is unlocked so it must be locked when the function is called. Returns <TT | |
140 CLASS="LITERAL" | |
141 >SDL_MUTEX_TIMEDOUT</TT | |
142 > if the condition is not signalled in the allotted time, <SPAN | |
143 CLASS="RETURNVALUE" | |
144 >0</SPAN | |
145 > if it was signalled or <SPAN | |
146 CLASS="RETURNVALUE" | |
147 >-1</SPAN | |
148 > on an error.</P | |
149 ></DIV | |
150 ><DIV | |
151 CLASS="REFSECT1" | |
152 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
153 NAME="AEN8412" |
0 | 154 ></A |
155 ><H2 | |
156 >See Also</H2 | |
157 ><P | |
158 ><A | |
159 HREF="sdlcondwait.html" | |
160 ><TT | |
161 CLASS="FUNCTION" | |
162 >SDL_CondWait</TT | |
163 ></A | |
164 ></P | |
165 ></DIV | |
166 ><DIV | |
167 CLASS="NAVFOOTER" | |
168 ><HR | |
169 ALIGN="LEFT" | |
170 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
171 SUMMARY="Footer navigation table" |
0 | 172 WIDTH="100%" |
173 BORDER="0" | |
174 CELLPADDING="0" | |
175 CELLSPACING="0" | |
176 ><TR | |
177 ><TD | |
178 WIDTH="33%" | |
179 ALIGN="left" | |
180 VALIGN="top" | |
181 ><A | |
182 HREF="sdlcondwait.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
183 ACCESSKEY="P" |
0 | 184 >Prev</A |
185 ></TD | |
186 ><TD | |
187 WIDTH="34%" | |
188 ALIGN="center" | |
189 VALIGN="top" | |
190 ><A | |
191 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
192 ACCESSKEY="H" |
0 | 193 >Home</A |
194 ></TD | |
195 ><TD | |
196 WIDTH="33%" | |
197 ALIGN="right" | |
198 VALIGN="top" | |
199 ><A | |
200 HREF="time.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
201 ACCESSKEY="N" |
0 | 202 >Next</A |
203 ></TD | |
204 ></TR | |
205 ><TR | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="left" | |
209 VALIGN="top" | |
210 >SDL_CondWait</TD | |
211 ><TD | |
212 WIDTH="34%" | |
213 ALIGN="center" | |
214 VALIGN="top" | |
215 ><A | |
216 HREF="thread.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
217 ACCESSKEY="U" |
0 | 218 >Up</A |
219 ></TD | |
220 ><TD | |
221 WIDTH="33%" | |
222 ALIGN="right" | |
223 VALIGN="top" | |
224 >Time</TD | |
225 ></TR | |
226 ></TABLE | |
227 ></DIV | |
228 ></BODY | |
229 ></HTML | |
230 > |