diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-06-15 17:08:52 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-06-15 17:08:52 +0200 |
| commit | 913029f4c59129ec16f871f50fc2df3f3d76a204 (patch) | |
| tree | 257818042a4bb37f512710e1ff1cece73ebaa12c /src/libtools/threads.c | |
| parent | c667c71a999dcbb396876a0ab49b36833ffd5111 (diff) | |
| download | box64-913029f4c59129ec16f871f50fc2df3f3d76a204.tar.gz box64-913029f4c59129ec16f871f50fc2df3f3d76a204.zip | |
Small work around pthread_once
Diffstat (limited to 'src/libtools/threads.c')
| -rwxr-xr-x | src/libtools/threads.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c index 93219381..cedab70b 100755 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -619,18 +619,17 @@ static __thread uintptr_t my_once_callback_fct = 0; static void my_once_callback() { if(my_once_callback_fct) { - if(GetNativeFnc((uintptr_t)my_once_callback_fct)) { - vFv_t f = (vFv_t)GetNativeFnc((uintptr_t)my_once_callback_fct); - f(); - return; - } - RunFunction(my_context, my_once_callback_fct, 0, 0); + EmuCall(thread_get_emu(), my_once_callback_fct); // avoid DynaCall for now + //RunFunction(my_context, my_once_callback_fct, 0, 0); } } -int EXPORT my_pthread_once(x64emu_t* emu, void* once, void* cb) +int EXPORT my_pthread_once(x64emu_t* emu, int* once, void* cb) { (void)emu; + void * n = GetNativeFnc((uintptr_t)cb); + if(n) + return pthread_once(once, n); my_once_callback_fct = (uintptr_t)cb; return pthread_once(once, my_once_callback); } |