Skip to content

Commit

Permalink
fix(core): allow recursive locking with musl libc
Browse files Browse the repository at this point in the history
* refactor(core): Use recursive locks [93838cd] introduced recursive locking.

* PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not defined in musl libc
* use PTHREAD_MUTEX_INITIALIZER on musl libc systems

Signed-off-by: Goetz Goerisch <[email protected]>
  • Loading branch information
GoetzGoerisch committed Jan 23, 2025
1 parent 403f462 commit f43576f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/open62541/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,11 @@ typedef struct {
int mutexCounter;
} UA_Lock;

#if defined(__GLIBC__)
#define UA_LOCK_STATIC_INIT {PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, 0}
#else
#define UA_LOCK_STATIC_INIT {PTHREAD_MUTEX_INITIALIZER, 0}
#endif

static UA_INLINE void
UA_LOCK_INIT(UA_Lock *lock) {
Expand Down

0 comments on commit f43576f

Please sign in to comment.