diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-03 16:43:42 +0100 |
| commit | f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d (patch) | |
| tree | 211276c3587721126ded00be46487bf23b605591 /src/libtools | |
| parent | f73fbd3cee38b4c0086c934d73972375c9c8c7d6 (diff) | |
| download | box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.tar.gz box64-f4829a8ce42b1abbcc8621802d6c6fad3a56cd5d.zip | |
More infrastructure added to elf and x64 emu
Diffstat (limited to 'src/libtools')
| -rwxr-xr-x | src/libtools/threads.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c index a245d6a9..64cc414a 100755 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -12,7 +12,7 @@ #include "box64context.h" #include "threads.h" #include "emu/x64emu_private.h" -//#include "tools/bridge_private.h" +#include "tools/bridge_private.h" #include "x64run.h" #include "x64emu.h" #include "box64stack.h" @@ -22,7 +22,7 @@ #include "emu/x64run_private.h" #include "x64trace.h" //#include "dynarec.h" -//#include "bridge.h" +#include "bridge.h" #ifdef DYNAREC #include "dynablock.h" #endif @@ -756,31 +756,31 @@ EXPORT int my_pthread_mutex_unlock(pthread_mutex_t *m) #endif #endif -//static void emujmpbuf_destroy(void* p) -//{ -// emu_jmpbuf_t *ej = (emu_jmpbuf_t*)p; -// free(ej->jmpbuf); -// free(ej); -//} +static void emujmpbuf_destroy(void* p) +{ + emu_jmpbuf_t *ej = (emu_jmpbuf_t*)p; + free(ej->jmpbuf); + free(ej); +} -//static pthread_key_t jmpbuf_key; +static pthread_key_t jmpbuf_key; -//emu_jmpbuf_t* GetJmpBuf() -//{ -// emu_jmpbuf_t *ejb = (emu_jmpbuf_t*)pthread_getspecific(jmpbuf_key); -// if(!ejb) { -// ejb = (emu_jmpbuf_t*)calloc(1, sizeof(emu_jmpbuf_t)); -// ejb->jmpbuf = calloc(1, sizeof(struct __jmp_buf_tag)); -// pthread_setspecific(jmpbuf_key, ejb); -// } -// return ejb; -//} +emu_jmpbuf_t* GetJmpBuf() +{ + emu_jmpbuf_t *ejb = (emu_jmpbuf_t*)pthread_getspecific(jmpbuf_key); + if(!ejb) { + ejb = (emu_jmpbuf_t*)calloc(1, sizeof(emu_jmpbuf_t)); + ejb->jmpbuf = calloc(1, sizeof(struct __jmp_buf_tag)); + pthread_setspecific(jmpbuf_key, ejb); + } + return ejb; +} void init_pthread_helper() { // InitCancelThread(); // mapcond = kh_init(mapcond); -// pthread_key_create(&jmpbuf_key, emujmpbuf_destroy); + pthread_key_create(&jmpbuf_key, emujmpbuf_destroy); #ifndef NOALIGN // unaligned_mutex = kh_init(mutex); #endif |