From 5e09a9246c84536a1f5a186bf5c3b9c62d725080 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Fri, 27 Dec 2024 11:45:04 +0100 Subject: [PATCH] sdl: fix shutdown hang on MacOS when SDL threads are used Change-Id: I2179d2beed89beba1716072fc06b9cc090118364 --- firmware/target/hosted/sdl/system-sdl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c index 246a6541f7..d3ec12b909 100644 --- a/firmware/target/hosted/sdl/system-sdl.c +++ b/firmware/target/hosted/sdl/system-sdl.c @@ -157,6 +157,9 @@ void power_off(void) /* since sim_thread_shutdown() grabs the mutex we need to let it free, * otherwise SDL_WaitThread will deadlock */ struct thread_entry* t = sim_thread_unlock(); + + if (!evt_thread) /* no event thread on MacOS */ + sim_thread_shutdown(); #endif /* wait for event thread to finish */ SDL_WaitThread(evt_thread, NULL);