From 45d885e2a9ec8614c8af8c359c3026efb4896355 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 26 Dec 2023 17:34:51 +0100 Subject: [PATCH] (Android) Workaround for an SDL issue where SDL_PollEvent() consumes all available CPU cycles when the application has been stopped --- es-app/src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index a284ebe34..ceaa16623 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -494,6 +494,14 @@ void applicationLoop() #if !defined(__EMSCRIPTEN__) while (true) { #endif + +#if defined(__ANDROID__) + // Workaround for an SDL issue where SDL_PollEvent() consumes all available CPU + // cycles when the application has been stopped. + while (AndroidVariables::sPaused) + SDL_Delay(10); +#endif + if (SDL_PollEvent(&event)) { do { InputManager::getInstance().parseEvent(event);