Mercurial > sdl-ios-xcode
diff src/events/SDL_events.c @ 1028:5ba65305c954
Fix various problems with the timer code.
* SDL_timer_running wasn't always updated correctly.
* Fixed occasional crash in SDL_SetTimer() when clearing threaded timers
* It was possible to get both the timer thread and event thread running
* Other misc. cleanup
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 13 Jan 2005 23:24:56 +0000 |
parents | b8d311d90021 |
children | 28ac87a38c17 |
line wrap: on
line diff
--- a/src/events/SDL_events.c Wed Jan 12 19:38:24 2005 +0000 +++ b/src/events/SDL_events.c Thu Jan 13 23:24:56 2005 +0000 @@ -91,7 +91,6 @@ static int SDL_GobbleEvents(void *unused) { - SDL_SetTimerThreaded(2); event_thread = SDL_ThreadID(); while ( SDL_EventQ.active ) { SDL_VideoDevice *video = current_video; @@ -114,7 +113,7 @@ /* Give up the CPU for the rest of our timeslice */ SDL_EventLock.safe = 1; - if( SDL_timer_running ) { + if ( SDL_timer_running ) { SDL_ThreadedTimerCheck(); } SDL_Delay(1); @@ -162,6 +161,8 @@ } SDL_EventLock.safe = 0; + /* The event thread will handle timers too */ + SDL_SetTimerThreaded(2); SDL_EventThread = SDL_CreateThread(SDL_GobbleEvents, NULL); if ( SDL_EventThread == NULL ) { return(-1);