about summary refs log tree commit diff stats
path: root/src/libtools/threads.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-06-14 14:53:20 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-06-14 14:53:20 +0200
commit730e129a800f2406ff7b879931c433438b69c6cd (patch)
tree79191eb6c15a0b813a1c0462d9e95eb5f103d738 /src/libtools/threads.c
parent883fc1681d214efe8c2d43089e2e38900d6d7db2 (diff)
downloadbox64-730e129a800f2406ff7b879931c433438b69c6cd.tar.gz
box64-730e129a800f2406ff7b879931c433438b69c6cd.zip
Change the way locked mutex are detected (taken from box86)
Diffstat (limited to 'src/libtools/threads.c')
-rwxr-xr-xsrc/libtools/threads.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c
index 83de0da9..93219381 100755
--- a/src/libtools/threads.c
+++ b/src/libtools/threads.c
@@ -1103,15 +1103,12 @@ void fini_pthread_helper(box64context_t* context)
 	}
 }
 
-int checkMutex(void* m)
+int checkUnlockMutex(void* m)
 {
 	pthread_mutex_t* mutex = (pthread_mutex_t*)m;
-	int ret = pthread_mutex_trylock(mutex);
+	int ret = pthread_mutex_unlock(mutex);
 	if(ret==0) {
-		pthread_mutex_unlock(mutex);
-		return 0;
-	}
-	if(ret==EDEADLK)
 		return 1;
+	}
 	return 0;
 }