Mercurial > sdl-ios-xcode
annotate docs/html/sdldestroysemaphore.html @ 934:af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
From: Eric Wing <ewing2121@yahoo.com>
Subject: New OS X patch (was Re: [SDL] Bug with inverted mouse coordinates in
I have a new patch for OS X I would like to submit.
First, it appears no further action has been taken on
my fix from Apple on the OpenGL windowed mode mouse
inversion problem. The fix would reunify the code, and
no longer require case checking for which version of
the OS you are running. This is probably a good fix
because the behavior with the old code could change
again with future versions of the OS, so those fixes
are included in this new patch.
But in addition, when I was at Apple, I asked them
about the ability to distinguish between the modifier
keys on the left and right sides of the keyboard (e.g.
Left Shift, Right Shift, Left/Right Alt, L/R Cmd, L/R
Ctrl). They told me that starting with Panther, the OS
began supporting this feature. This has always been a
source of annoyance for me when bringing a program
that comes from Windows or Linux to OS X when the
keybindings happened to need distinguishable left-side
and right-side keys. So the rest of the patch I am
submitting contains new code to support this feature
on Panther (and presumably later versions of the OS).
So after removing the OS version checks for the mouse
inversion problem, I reused the OS version checks to
activate the Left/Right detection of modifier keys. If
you are running Panther (or above), the new code will
attempt to distinguish between sides. For the older
OS's, the code path reverts to the original code.
I've tested with Panther on a G4 Cube, G5 dual
processor, and Powerbook Rev C. The Cube and G5
keyboards demonstrated the ability to distinguish
between sides. The Powerbook seems to only have
left-side keys, but the patch was still able to handle
it by producing the same results as before the patch.
I also wanted to test a non-Apple keyboard.
Unfortunately, I don't have any PC USB keyboards.
However, I was able to borrow a Sun Microsystems USB
keyboard, so I tried that out on the G5, and I got the
correct behavior for left and right sides. I'm
expecting that if it worked with a Sun keyboard, most
other keyboards should work with no problems.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 20 Aug 2004 22:35:23 +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 > |