Skip to content

Commit d775683

Browse files
committed
Amend fix for #9 to apply to other Unix systems
At least the musl libc on Linux has the same issue as Mac OS X: the PTHREAD_RECURSIVE_* static initialiser does not exist. This is a documented and purposeful omission: http://www.openwall.com/lists/musl/2017/02/20/3 This commit uses similar logic to the Apple test on other Unixes.
1 parent 6db39b0 commit d775683

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/actions.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2051,7 +2051,11 @@ namespace {
20512051
static pthread_mutex_t cs = PTHREAD_MUTEX_INITIALIZER;
20522052
#endif
20532053
#else
2054-
static pthread_mutex_t cs = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
2054+
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
2055+
static pthread_mutex_t cs = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
2056+
#else
2057+
static pthread_mutex_t cs = PTHREAD_MUTEX_INITIALIZER;
2058+
#endif
20552059
#endif
20562060
#endif
20572061

0 commit comments

Comments
 (0)