From d4fd2c4bc5ac7440e7f3ab393bebb76a1728abdf Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Sun, 10 Jan 2010 17:50:25 +0100 Subject: [PATCH] FIX: Macos has no static initializer for recursive mutexes --- src/nobug_resources.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nobug_resources.c b/src/nobug_resources.c index e005869..ee75fb5 100644 --- a/src/nobug_resources.c +++ b/src/nobug_resources.c @@ -54,7 +54,7 @@ #endif #if NOBUG_USE_PTHREAD -pthread_mutex_t nobug_resource_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +pthread_mutex_t nobug_resource_mutex; #endif #define nobug_resourcestates \ @@ -93,6 +93,13 @@ static void nobug_resource_node_dtor (void*); void nobug_resource_init (void) { +#if NOBUG_USE_PTHREAD + static pthread_mutexattr_t attr; + pthread_mutexattr_init (&attr); + pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init (&nobug_resource_mutex, &attr); +#endif + llist_init (&nobug_resource_registry); mpool_init (&nobug_resource_record_pool, -- 2.11.4.GIT