Mercurial > sdl-ios-xcode
annotate CREDITS @ 3069:caefe2344f65
Date: Thu, 27 Dec 2007 07:38:25 +0000
From: John Bartholomew
Subject: [SDL] SDL Semaphore implementation broken on Windows?
Hi,
Over the past couple of days, I've been battling with SDL, SDL_Mixer and SMPEG to try to find an audio hang bug. I believe I've found the problem, which I think is a race condition inside SDL's semaphore implementation (at least the Windows implementation). The semaphore code uses Windows' built in semaphore functions, but it also maintains a separate count value. This count value is updated with bare increment and decrement operations in SemPost and SemWaitTimeout - no locking primitives to protect them.
In tracking down the apparent audio bug, I found that at some point a semaphore's count value was being decremented to -1, which is clearly not a valid value for it to take.
I'm still not certain exactly what sequence of operations is occuring for this to happen, but I believe that overall it's a race condition between a thread calling SemPost (which increments the count) and the thread on the other end calling SemWait (which decrements it).
I will try to make a test case to verify this, but I'm not sure if I'll be able to (threading errors being difficult to reproduce even in the best circumstances).
However, assuming this is the cause of my problems, there is a very
simple fix:
Windows provides InterlockedIncrement() and InterlockedDecrement()
functions to perform increments and decrements which are guaranteed to be atomic. So the fix is in thread/win32/SDL_syssem.c: replace occurrences of --sem->count with InterlockedDecrement(&sem->count); and replace occurrences of ++sem->count with InterlockedIncrement(&sem->count);
This is using SDL v1.2.12, built with VC++ 2008 Express, running on a
Core 2 duo processor.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 17 Feb 2009 05:39:18 +0000 |
parents | 20d65430e63c |
children | 7b1da3f37f97 |
rev | line source |
---|---|
0 | 1 |
2 Simple DirectMedia Layer CREDITS | |
3 Thanks to everyone who made this possible, including: | |
4 | |
5 * Cliff Matthews, for giving me a reason to start this project. :) | |
6 -- Executor rocks! *grin* | |
7 | |
828
85ba077211bc
Lots of people have contributed cash. :)
Sam Lantinga <slouken@libsdl.org>
parents:
827
diff
changeset
|
8 * The Linux Fund, C Magazine, Educational Technology Resources Inc., |
85ba077211bc
Lots of people have contributed cash. :)
Sam Lantinga <slouken@libsdl.org>
parents:
827
diff
changeset
|
9 Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson, |
85ba077211bc
Lots of people have contributed cash. :)
Sam Lantinga <slouken@libsdl.org>
parents:
827
diff
changeset
|
10 Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker, |
85ba077211bc
Lots of people have contributed cash. :)
Sam Lantinga <slouken@libsdl.org>
parents:
827
diff
changeset
|
11 and Phoenix Kokido for financial contributions |
470 | 12 |
2987
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
13 * Edgar "bobbens" Simo for his force feedback API development during the |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
14 Google Summer of Code 2008 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
15 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
16 * Aaron Wishnick for his work on audio resampling and pitch shifting during |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
17 the Google Summer of Code 2008 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
18 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
19 * Holmes Futrell for port of SDL to the iPhone and iPod Touch during the |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
20 Google Summer of Code 2008 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
21 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
22 * Darren Alton for port of SDL to the Nintendo DS during the Google Summer |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
23 of Code 2008 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
24 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
25 * Szymon "Wilku" Wilczek for adding support for multiple mice and tablets |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
26 during the Google Summer of Code 2008 |
5b8865f87df1
Added the Google Summer of Code folks to the credits.
Sam Lantinga <slouken@libsdl.org>
parents:
2976
diff
changeset
|
27 |
3034
0e821769fc51
Fixed NULL pointer dereference
Sam Lantinga <slouken@libsdl.org>
parents:
3005
diff
changeset
|
28 * Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni, |
3041
20d65430e63c
Fixed OpenGL state issue reported by Dmytro Bogovych
Sam Lantinga <slouken@libsdl.org>
parents:
3034
diff
changeset
|
29 Dmytro Bogovych, and Couriersud for helping find SDL 1.3 bugs in the great |
20d65430e63c
Fixed OpenGL state issue reported by Dmytro Bogovych
Sam Lantinga <slouken@libsdl.org>
parents:
3034
diff
changeset
|
30 SDL Bug Hunt of January 2009! |
3005
7b7a25d08829
Added Donny Viszneki to the credits for finding and fixing SDL 1.3 bugs
Sam Lantinga <slouken@libsdl.org>
parents:
2987
diff
changeset
|
31 |
7b7a25d08829
Added Donny Viszneki to the credits for finding and fixing SDL 1.3 bugs
Sam Lantinga <slouken@libsdl.org>
parents:
2987
diff
changeset
|
32 * Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of |
7b7a25d08829
Added Donny Viszneki to the credits for finding and fixing SDL 1.3 bugs
Sam Lantinga <slouken@libsdl.org>
parents:
2987
diff
changeset
|
33 January 2009! |
2946
29e1f863a844
Kicking off the great SDL Bug Hunt for January 2009
Sam Lantinga <slouken@libsdl.org>
parents:
2225
diff
changeset
|
34 |
470 | 35 * Gaëtan de Menten for writing the PHP and SQL behind the SDL website |
159
9841293e9e86
Time to recognize everyone again. :)
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
36 |
827
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
37 * Tim Jones for the new look of the SDL website |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
38 |
470 | 39 * Ryan Gordon for helping everybody out and keeping the dream alive. :) |
40 | |
41 * Mattias Engdegård, for help with the Solaris port and lots of other help | |
0 | 42 |
1621 | 43 * Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port |
0 | 44 |
2225
3bca1b7ca25b
Updated the credits for SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents:
1981
diff
changeset
|
45 * Couriersud for the DirectFB driver |
0 | 46 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
250
diff
changeset
|
47 * Patrice Mandin, for the Atari port |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
250
diff
changeset
|
48 |
827
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
49 * Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation |
470 | 50 |
827
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
51 * Arne Claus, for the 2004 winning SDL logo, |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
52 and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann, |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
53 Daniel Liljeberg, Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella, |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
54 Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson, |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
55 S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand, |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
56 Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller, |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
57 Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
58 for other logo entries. |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
59 |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
60 * Bob Pendleton and David Olofson for being long time contributors to |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
61 the SDL mailing list. |
b10aeac509ea
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
470
diff
changeset
|
62 |
470 | 63 * Everybody at Loki Software, Inc. for their great contributions! |
0 | 64 |
65 And a big hand to everyone else who gave me appreciation, advice, | |
66 and suggestions, especially the good folks on the SDL mailing list. | |
67 | |
68 THANKS! :) | |
69 | |
70 -- Sam Lantinga <slouken@libsdl.org> | |
71 |