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); }
void SDL_PumpEvents(void) { if ( !SDL_EventThread ) { 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 } }
/* Run the system dependent event loops */ void SDL_PumpEvents(void) { if ( !SDL_EventThread ) { 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 } }