summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/rts/OSThreads.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/includes/rts/OSThreads.h b/includes/rts/OSThreads.h
index b57799fd55..b711036b17 100644
--- a/includes/rts/OSThreads.h
+++ b/includes/rts/OSThreads.h
@@ -44,11 +44,12 @@ typedef pthread_key_t ThreadLocalKey;
#endif
/* Always check the result of lock and unlock. */
-#define OS_ACQUIRE_LOCK(mutex) \
+#define OS_ACQUIRE_LOCK(mutex) { \
LOCK_DEBUG_BELCH("ACQUIRE_LOCK", mutex); \
- if (pthread_mutex_lock(mutex) == EDEADLK) { \
- barf("multiple ACQUIRE_LOCK: %s %d", __FILE__,__LINE__); \
- }
+ int __r = pthread_mutex_lock(mutex); \
+ if (__r != 0) { \
+ barf("ACQUIRE_LOCK failed (%s:%d): %d", __FILE__, __LINE__, __r); \
+ } }
// Returns zero if the lock was acquired.
EXTERN_INLINE int OS_TRY_ACQUIRE_LOCK(pthread_mutex_t *mutex);