thread: Remove semaphore in thread creation.

This was added so that the new thread definitely has its threadid set, via
SDL_GetCurrentThreadID(), before SDL_CreatThread returns, but this broke
Emscripten, which can't wait on a newly-created thread, since the thread won't
start until a later mainloop iteration.

Now we have the creating thread set this id in SDL_SYS_CreateThread, where
platform-specific logic can figure out how to calculate the new thread's ID
from the parent thread, without using SDL_GetCurrentThreadID().

Fixes #15509.

(cherry picked from commit 922b872b4f)
This commit is contained in:
Ryan C. Gordon
2026-05-04 23:43:34 -04:00
parent 3013f975ac
commit 6d35168a63
8 changed files with 16 additions and 18 deletions

View File

@@ -116,6 +116,8 @@ bool SDL_SYS_CreateThread(SDL_Thread *thread,
return SDL_SetError("Not enough resources to create thread");
}
thread->threadid = (SDL_ThreadID) thread->handle; // the SDL thread ID is just the pthread_t.
return true;
}