mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-13 15:13:54 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user