Wake the main thread for main function dispatch

Also added a test case to catch the main thread waiting indefinitely when a function is pending.

Fixes https://github.com/libsdl-org/SDL/issues/12390
This commit is contained in:
Sam Lantinga committed 2025-02-25 12:50:41 -08:00
1 parent f0f593f04b
commit 049a7a04de
2 files changed
+60 -12

No files matched your search

+3
View File
@@ -1371,6 +1371,9 @@ bool SDL_RunOnMainThread(SDL_MainThreadCallback callback, void *userdata, bool w
}
SDL_UnlockMutex(SDL_main_callbacks_lock);
// If the main thread is waiting for events, wake it up
SDL_SendWakeupEvent();
if (!wait_complete) {
// Queued for execution, wait not requested
return true;