about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-05-07 14:12:16 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-05-07 14:12:16 +0200
commit3221038bc664158431f64b491800f56955044d91 (patch)
tree62506b19bd7f83b2d489992ca50c22408540c9f5 /src/include
parent0359a65a00cbabee67515f53cf58ed7bc894e0ee (diff)
downloadbox64-3221038bc664158431f64b491800f56955044d91.tar.gz
box64-3221038bc664158431f64b491800f56955044d91.zip
[DYNAREC] Disabled custom mutex for now
Diffstat (limited to 'src/include')
-rwxr-xr-xsrc/include/box64context.h15
-rwxr-xr-xsrc/include/threads.h2
2 files changed, 14 insertions, 3 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h
index 3fe285dc..bda5bf23 100755
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -8,6 +8,11 @@
 #include "dynarec/native_lock.h"
 #endif
 
+#ifdef DYNAREC
+// disabling for now, seems to have a negative impact on performances
+//#define USE_CUSTOM_MUTEX
+#endif
+
 typedef struct elfheader_s elfheader_t;
 typedef struct cleanup_s cleanup_t;
 typedef struct x64emu_s x64emu_t;
@@ -129,11 +134,19 @@ typedef struct box64context_s {
     pthread_mutex_t     mutex_thread;
     pthread_mutex_t     mutex_bridge;
     #else
+    #ifdef USE_CUSTOM_MUTEX
     uint32_t            mutex_dyndump;
     uint32_t            mutex_trace;
     uint32_t            mutex_tls;
     uint32_t            mutex_thread;
     uint32_t            mutex_bridge;
+    #else
+    pthread_mutex_t     mutex_dyndump;
+    pthread_mutex_t     mutex_trace;
+    pthread_mutex_t     mutex_tls;
+    pthread_mutex_t     mutex_thread;
+    pthread_mutex_t     mutex_bridge;
+    #endif
     uintptr_t           max_db_size;    // the biggest (in x86_64 instructions bytes) built dynablock
     int                 trace_dynarec;
     pthread_mutex_t     mutex_lock;     // this is for the Test interpreter
@@ -192,7 +205,7 @@ typedef struct box64context_s {
 
 } box64context_t;
 
-#ifndef DYNAREC
+#ifndef USE_CUSTOM_MUTEX
 #define mutex_lock(A)       pthread_mutex_lock(A)
 #define mutex_trylock(A)    pthread_mutex_trylock(A)
 #define mutex_unlock(A)     pthread_mutex_unlock(A)
diff --git a/src/include/threads.h b/src/include/threads.h
index d094dc0b..847d4ee6 100755
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -20,9 +20,7 @@ void fini_pthread_helper(box64context_t* context);
 // prepare an "emuthread structure" in pet and return address of function pointer for a "thread creation routine"
 void* my_prepare_thread(x64emu_t *emu, void* f, void* arg, int ssize, void** pet);
 
-#ifndef DYNAREC
 //check and unlock if a mutex is locked by current thread (works only for PTHREAD_MUTEX_ERRORCHECK typed mutex)
 int checkUnlockMutex(void* m);
-#endif
 
 #endif //_THREADS_H_
\ No newline at end of file