From 98bb78ae3a34550212c6f68c8a11ba1daa855aae Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 29 Oct 2022 16:49:13 +0200 Subject: Optimized custom pthread_once --- src/libtools/threads.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/libtools/threads.c') diff --git a/src/libtools/threads.c b/src/libtools/threads.c index 25480a47..01f3a7c4 100755 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -674,6 +674,9 @@ static void* findcleanup_routineFct(void* fct) static __thread uintptr_t my_once_callback_fct = 0; int EXPORT my_pthread_once(x64emu_t* emu, int* once, void* cb) { + if(*once) // quick test first + return 0; + // slow test now #ifdef DYNAREC int old = native_lock_xchg_d(once, 1); #else -- cgit 1.4.1