init pthread mutexes only if an initializer exists
authorDerrick Brashear <shadow@dementia.org>
Wed, 27 Jan 2010 17:58:49 +0000 (12:58 -0500)
committerJeffrey Altman <jaltman|account-1000011@unknown>
Wed, 27 Jan 2010 18:01:59 +0000 (10:01 -0800)
and windows has none

Change-Id: Iaff3047abde197791e3fbb42c12066f896e540d1
Reviewed-on: http://gerrit.openafs.org/1169
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/des/new_rnd_key.c
src/rxkad/rxkad_server.c

index ca152b7..c22b296 100644 (file)
@@ -50,7 +50,11 @@ static int is_inited = 0;
  */
 
 #include <assert.h>
-pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t des_init_mutex
+#ifdef PTHREAD_MUTEX_INITIALIZER
+= PTHREAD_MUTEX_INITIALIZER
+#endif
+;
 #define LOCK_INIT assert(pthread_mutex_lock(&des_init_mutex)==0)
 #define UNLOCK_INIT assert(pthread_mutex_unlock(&des_init_mutex)==0)
 #else
@@ -189,7 +193,11 @@ static unsigned char sequence_number[8];
  */
 
 #include <assert.h>
-pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t des_random_mutex
+#ifdef PTHREAD_MUTEX_INITIALIZER
+= PTHREAD_MUTEX_INITIALIZER
+#endif
+;
 #define LOCK_RANDOM assert(pthread_mutex_lock(&des_random_mutex)==0)
 #define UNLOCK_RANDOM assert(pthread_mutex_unlock(&des_random_mutex)==0)
 #else
index 91e384c..7638482 100644 (file)
@@ -78,7 +78,11 @@ static fc_KeySchedule random_int32_schedule;
  */
 
 #include <assert.h>
-pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t rxkad_random_mutex
+#ifdef PTHREAD_MUTEX_INITIALIZER
+= PTHREAD_MUTEX_INITIALIZER
+#endif
+;
 #define LOCK_RM assert(pthread_mutex_lock(&rxkad_random_mutex)==0)
 #define UNLOCK_RM assert(pthread_mutex_unlock(&rxkad_random_mutex)==0)
 #else