From 85ce920cffea8380b03499dcbff6da56591d2b8f Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Sun, 17 Nov 2013 20:33:33 -0800 Subject: [PATCH] Use adaptive mutexes when available. --- include/libunwind_i.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/libunwind_i.h b/include/libunwind_i.h index f412e6ac..0be551fb 100644 --- a/include/libunwind_i.h +++ b/include/libunwind_i.h @@ -186,8 +186,15 @@ static inline void mark_as_used(void *v UNUSED) { # define SIGPROCMASK(how, new_mask, old_mask) mark_as_used(old_mask) #endif +/* Prefer adaptive mutexes if available */ +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +#define UNW_PTHREAD_MUTEX_INITIALIZER PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +#else +#define UNW_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#endif + #define define_lock(name) \ - pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER + pthread_mutex_t name = UNW_PTHREAD_MUTEX_INITIALIZER #define lock_init(l) mutex_init (l) #define lock_acquire(l,m) \ do { \