From 7e97a2b643342c9ca9eb9ff448b2038a6c61676b Mon Sep 17 00:00:00 2001 From: Jeffrey Lee Date: Fri, 31 May 2019 00:22:44 +0100 Subject: [PATCH] riscos: Fix thread starvation in fullscreen mode --- src/video/riscos/SDL_riscosevents.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c index f085994dd..319fd9dcd 100644 --- a/src/video/riscos/SDL_riscosevents.c +++ b/src/video/riscos/SDL_riscosevents.c @@ -44,6 +44,10 @@ #include "kernel.h" #include "swis.h" +#if !SDL_THREADS_DISABLED +#include +#endif + /* The translation table from a RISC OS internal key numbers to a SDL keysym */ static SDLKey RO_keymap[SDLK_LAST]; @@ -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) @@ -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 }