about summary refs log tree commit diff stats
path: root/src/libtools/threads.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-10-29 16:49:13 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-10-29 16:49:13 +0200
commit98bb78ae3a34550212c6f68c8a11ba1daa855aae (patch)
tree1c0f3ba24922b37a06f70644e571c9366b2c9fc7 /src/libtools/threads.c
parentdefe5ce594335cfa3f6eca9cb8ecbd65a3021af4 (diff)
downloadbox64-98bb78ae3a34550212c6f68c8a11ba1daa855aae.tar.gz
box64-98bb78ae3a34550212c6f68c8a11ba1daa855aae.zip
Optimized custom pthread_once
Diffstat (limited to 'src/libtools/threads.c')
-rwxr-xr-xsrc/libtools/threads.c3
1 files changed, 3 insertions, 0 deletions
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