From c51e2661835b4499f1125eb2d677a06260159dbc Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 27 Jan 2010 12:58:49 -0500 Subject: [PATCH] init pthread mutexes only if an initializer exists and windows has none Change-Id: Iaff3047abde197791e3fbb42c12066f896e540d1 Reviewed-on: http://gerrit.openafs.org/1169 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/des/new_rnd_key.c | 12 ++++++++++-- src/rxkad/rxkad_server.c | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/des/new_rnd_key.c b/src/des/new_rnd_key.c index ca152b7ef9..c22b296ae7 100644 --- a/src/des/new_rnd_key.c +++ b/src/des/new_rnd_key.c @@ -50,7 +50,11 @@ static int is_inited = 0; */ #include -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 -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 diff --git a/src/rxkad/rxkad_server.c b/src/rxkad/rxkad_server.c index 91e384caa4..7638482daf 100644 --- a/src/rxkad/rxkad_server.c +++ b/src/rxkad/rxkad_server.c @@ -78,7 +78,11 @@ static fc_KeySchedule random_int32_schedule; */ #include -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