[SDL] race condition in SDL_ThreadedTimerCheck?

Clifford T. Matthews ctm at ardi.com
Mon Jan 3 22:33:45 PST 2005


I have an application that uses SDL_SetTimer that dies on
Hyperthreaded P4s running Windows XP.  Looking at
SDL_ThreadedTimerCheck, I see this code:

			SDL_mutexV(SDL_timer_mutex);
			ms = t->cb(t->interval, t->param);
			SDL_mutexP(SDL_timer_mutex);

But without SDL_timer_mutex being held, can't the memory pointed to by
t be freed?  Shouldn't a copy of *t be made on the stack before the
lock is released and then that copy's cb, interval and param field be
used?

--Cliff Matthews <ctm at ardi.com>





More information about the SDL mailing list