diff options
| author | Yang Liu <numbksco@gmail.com> | 2024-05-24 16:14:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-24 10:14:49 +0200 |
| commit | 2ee846f48e7fa9b103f0949f63f91712ca7b03ca (patch) | |
| tree | e9521f080520ee0361275a4a6b3f5a5c4fca136f /src/wrapped/wrappedsdl2.c | |
| parent | 9c846a3e40ca96e580e4ab4b3db38f1ed7f791ea (diff) | |
| download | box64-2ee846f48e7fa9b103f0949f63f91712ca7b03ca.tar.gz box64-2ee846f48e7fa9b103f0949f63f91712ca7b03ca.zip | |
Workaround on a race condition on SDL_GetThreadID (#1530)
Diffstat (limited to 'src/wrapped/wrappedsdl2.c')
| -rw-r--r-- | src/wrapped/wrappedsdl2.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c index d12cea24..299237f2 100644 --- a/src/wrapped/wrappedsdl2.c +++ b/src/wrapped/wrappedsdl2.c @@ -820,6 +820,17 @@ EXPORT void my2_SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, uint16_t *vend, u } } +EXPORT unsigned long my2_SDL_GetThreadID(x64emu_t* emu, void* thread) +{ + unsigned long ret = my->SDL_GetThreadID(thread); + int max = 10; + while (!ret && max--) { + sched_yield(); + ret = my->SDL_GetThreadID(thread); + } + return ret; +} + #undef HAS_MY #define ALTMY my2_ |