[SDL] Audio! More than 5.1?
mjpelmea at syr.edu
Thu Jan 20 10:43:55 PST 2005
Last night I mentioned an apparent race condition in SDL. This
morning I've built SDL.dll using the mingw cross-compiler running on
Linux. I tried the obvious following fix, but my application died the
same way as before.
ms = t->cb(t->interval, t->param);
struct _SDL_TimerID timer;
timer = *t;
ms = timer.cb(timer.interval, timer.param);
After that failed, I tried removing the calls to SDL_mutexV and
SDL_MutexP that immediately bracket the callback invocation. That
got rid of the problem my application was having.
My application only touches memory from within the callback, then does
an SDL_CondSignal. It doesn't make any SDL timer calls from within
My guess is the SDL_mutexV and SDL_mutexP surrounding the callback in
SDL_ThreadedTimerCheck are so that applications can call the SDL timer
routines from within the callback. As such, merely getting rid of the
SDL_mutexV and SDL_mutexP calls is likely to break existing code.
However, since there's already one subtle race-condition in the code
that apparently isn't getting hit enough to attract attention, I'm
reluctant to attempt to fix this problem on my own, since my
application is clearly not similar to other applications using SDL
I'll poke around a bit more on this, but if there's anyone
particularly intimate with this section of code who wants to eyeball
it and look for other problems, that might lead to a robust solution
sooner than anything I can do.
--Cliff Matthews <ctm at ardi.com>
More information about the SDL