diff options
Diffstat (limited to 'src/libtools')
| -rw-r--r-- | src/libtools/threads.c | 5 | ||||
| -rwxr-xr-x | src/libtools/threads32.c | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c index f51f95c6..15a14422 100644 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -134,6 +134,10 @@ static void emuthread_destroy(void* p) emuthread_t *et = (emuthread_t*)p; if(!et) return; + #ifdef BOX32 + if(!et->join && et->fnc) + to_hash_d(et->self); + #endif FreeX64Emu(&et->emu); box_free(et); } @@ -177,6 +181,7 @@ void thread_set_emu(x64emu_t* emu) #ifdef BOX32 if(box64_is32bits) { et->self = (uintptr_t)pthread_self(); + et->hself = to_hash(et->self); } #endif pthread_setspecific(thread_key, et); 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) |