about summary refs log tree commit diff stats
path: root/src/libtools/threads.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-10-18 10:52:07 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-10-18 10:52:07 +0200
commitf568ae48444679fac8e0433ed8c80e1f1b10320a (patch)
tree87e10e7ef85e88cdcfbb4d19e8295196bfb3fe4f /src/libtools/threads.c
parent4edbdc005b60c048c7229e1cafc203f0b92e65ec (diff)
downloadbox64-f568ae48444679fac8e0433ed8c80e1f1b10320a.tar.gz
box64-f568ae48444679fac8e0433ed8c80e1f1b10320a.zip
[RV64_DYNAREC] Small refactor on SIGBUS special case handling
Diffstat (limited to 'src/libtools/threads.c')
-rw-r--r--src/libtools/threads.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c
index 1076b3e2..4fd26bf9 100644
--- a/src/libtools/threads.c
+++ b/src/libtools/threads.c
@@ -1281,3 +1281,16 @@ int checkUnlockMutex(void* m)
 	}
 	return 0;
 }
+
+int checkNolockMutex(void* m)
+{
+	pthread_mutex_t* mutex = (pthread_mutex_t*)m;
+	int ret = pthread_mutex_trylock(mutex);
+	if(ret==0) {
+		pthread_mutex_unlock(mutex);
+		return 0;
+	}
+	if(ret == EDEADLK)
+		return 1;
+	return 0;
+}