static int RunTimer(void *unused) { while ( timer_alive ) { SDL_ThreadedTimerCheck(); SDL_Delay(1); } return(0); }
DWORD TimersThreadProc(void *data) { while(WaitForSingleObject(timersQuitEvent, 10) == WAIT_TIMEOUT) { SDL_ThreadedTimerCheck(); } return 0; }
static int RunTimer(void *unused) { while ( timer_alive ) { if ( SDL_timer_running ) { SDL_ThreadedTimerCheck(); } SDL_Delay(10); } return(0); }
static int SDLCALL SDL_GobbleEvents(void *unused) { event_thread = SDL_ThreadID(); #ifdef __OS2__ #ifdef USE_DOSSETPRIORITY /* Increase thread priority, so it will process events in time for sure! */ DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, +16, 0); #endif #endif while ( SDL_EventQ.active ) { SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; /* Get events from the video subsystem */ if ( video ) { video->PumpEvents(this); } /* Queue pending key-repeat events */ SDL_CheckKeyRepeat(); #if !SDL_JOYSTICK_DISABLED /* Check for joystick state change */ if ( SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK) ) { SDL_JoystickUpdate(); } #endif /* Give up the CPU for the rest of our timeslice */ SDL_EventLock.safe = 1; if ( SDL_timer_running ) { SDL_ThreadedTimerCheck(); } SDL_Delay(1); /* Check for event locking. On the P of the lock mutex, if the lock is held, this thread will wait until the lock is released before continuing. The safe flag will be set, meaning that the other thread can go about it's business. The safe flag is reset before the V, so as soon as the mutex is free, other threads can see that it's not safe to interfere with the event thread. */ SDL_mutexP(SDL_EventLock.lock); SDL_EventLock.safe = 0; SDL_mutexV(SDL_EventLock.lock); } SDL_SetTimerThreaded(0); event_thread = 0; return(0); }
static int SDLCALL SDL_GobbleEvents(void *unused) { event_thread = SDL_ThreadID(); #ifdef __OS2__ #ifdef USE_DOSSETPRIORITY DosSetPriority(PRTYS_THREAD, PRTYC_REGULAR, +16, 0); #endif #endif while ( SDL_EventQ.active ) { SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; if ( video ) { video->PumpEvents(this); } SDL_CheckKeyRepeat(); #if !SDL_JOYSTICK_DISABLED if ( SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK) ) { SDL_JoystickUpdate(); } #endif SDL_EventLock.safe = 1; if ( SDL_timer_running ) { SDL_ThreadedTimerCheck(); } SDL_Delay(1); SDL_mutexP(SDL_EventLock.lock); SDL_EventLock.safe = 0; SDL_mutexV(SDL_EventLock.lock); } SDL_SetTimerThreaded(0); event_thread = 0; return(0); }
static int SDLCALL SDL_GobbleEvents(void *unused) { event_thread = SDL_ThreadID(); while (SDL_EventQ.active) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); /* Get events from the video subsystem */ if (_this) { _this->PumpEvents(_this); } #if !SDL_JOYSTICK_DISABLED /* Check for joystick state change */ if (SDL_numjoysticks && (SDL_eventstate & SDL_JOYEVENTMASK)) { SDL_JoystickUpdate(); } #endif /* Give up the CPU for the rest of our timeslice */ SDL_EventLock.safe = 1; if (SDL_timer_running) { SDL_ThreadedTimerCheck(); } SDL_Delay(1); /* Check for event locking. On the P of the lock mutex, if the lock is held, this thread will wait until the lock is released before continuing. The safe flag will be set, meaning that the other thread can go about it's business. The safe flag is reset before the V, so as soon as the mutex is free, other threads can see that it's not safe to interfere with the event thread. */ SDL_mutexP(SDL_EventLock.lock); SDL_EventLock.safe = 0; SDL_mutexV(SDL_EventLock.lock); } SDL_SetTimerThreaded(0); event_thread = 0; return (0); }
static void RunTimer(void) { supervisor=SDL_TRUE; SDL_ThreadedTimerCheck(); supervisor=SDL_FALSE; }
static void CALLBACK HandleAlarm(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) { SDL_ThreadedTimerCheck(); }