From 913029f4c59129ec16f871f50fc2df3f3d76a204 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 15 Jun 2021 17:08:52 +0200 Subject: Small work around pthread_once --- src/libtools/threads.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/libtools/threads.c') 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); } -- cgit 1.4.1