about summary refs log tree commit diff stats
path: root/src/libtools/threads32.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-10 16:55:25 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-10 16:55:25 +0200
commit2127eaea221e89a44ececc87bc74f7d7b44873d0 (patch)
tree31b933173829048a29d4fb08ff4fddd606831a0b /src/libtools/threads32.c
parent7794a623aa27351b12a50fe9bf9f92ddac10d512 (diff)
downloadbox64-2127eaea221e89a44ececc87bc74f7d7b44873d0.tar.gz
box64-2127eaea221e89a44ececc87bc74f7d7b44873d0.zip
[BOX32] Put back pthread_t behind hash, but ease hash range to have more native values
Diffstat (limited to 'src/libtools/threads32.c')
-rwxr-xr-xsrc/libtools/threads32.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libtools/threads32.c b/src/libtools/threads32.c
index 755c2cd2..74820c4f 100755
--- a/src/libtools/threads32.c
+++ b/src/libtools/threads32.c
@@ -99,6 +99,8 @@ static void emuthread_destroy(void* p)
 	if(!et)
 		return;
 	// destroy thread emu and all
+	if(!et->join && et->fnc)	// if there is no function, that this thread was not built from a create_thread, don't touch the hash...
+		to_hash_d(et->self);
 	FreeX64Emu(&et->emu);
 	free(et);
 }
@@ -135,6 +137,7 @@ static void* pthread_routine(void* p)
 	emuthread_t *et = (emuthread_t*)p;
 	et->emu->type = EMUTYPE_MAIN;
 	et->self = (uintptr_t)pthread_self();
+	et->hself = to_hash(et->self);
 	// setup callstack and run...
 	x64emu_t* emu = et->emu;
 	Push_32(emu, 0);	// PUSH 0 (backtrace marker: return address is 0)