Skip to content

Commit

Permalink
riscos: Fix thread starvation in fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Phlamethrower committed May 30, 2019
1 parent 64586a7 commit 7e97a2b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/video/riscos/SDL_riscosevents.c
Expand Up @@ -44,6 +44,10 @@
#include "kernel.h"
#include "swis.h"

#if !SDL_THREADS_DISABLED
#include <pthread.h>
#endif

/* The translation table from a RISC OS internal key numbers to a SDL keysym */
static SDLKey RO_keymap[SDLK_LAST];

Expand Down Expand Up @@ -83,6 +87,9 @@ extern void DRenderer_FillBuffers();
/* Timer running function */
extern void RISCOS_CheckTimer();

#else
extern int riscos_using_threads;

#endif

void FULLSCREEN_PumpEvents(_THIS)
Expand All @@ -93,6 +100,14 @@ void FULLSCREEN_PumpEvents(_THIS)
#if SDL_THREADS_DISABLED
// DRenderer_FillBuffers();
if (SDL_timer_running) RISCOS_CheckTimer();
#else
/* Stop thread starvation, which will occur if the main loop
doesn't call SDL_Delay */
if (riscos_using_threads)
{
pthread_yield();
}

#endif
}

Expand Down

0 comments on commit 7e97a2b

Please sign in to comment.