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
2025-02-25 12:23:32 -08:00
parent f0f593f04b
commit 049a7a04de
2 changed files with 60 additions and 12 deletions

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;