initialize pthread mutexes to avoid compiler common variable stupidity
authorDerrick Brashear <shadow@dementia.org>
Tue, 26 Jan 2010 18:32:03 +0000 (13:32 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Wed, 27 Jan 2010 16:59:02 +0000 (08:59 -0800)
instead of worrying about ranlib versus ranlib -c, -fno-common, etc,
just initialize the variables if an initializer exists

Change-Id: I6ed28df4d2134f84359a1bc55706e75d54e6e083
Reviewed-on: http://gerrit.openafs.org/1166
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

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

index 81b7cd0..ca152b7 100644 (file)
@@ -50,7 +50,7 @@ static int is_inited = 0;
  */
 
 #include <assert.h>
-pthread_mutex_t des_init_mutex;
+pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER;
 #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 +189,7 @@ static unsigned char sequence_number[8];
  */
 
 #include <assert.h>
-pthread_mutex_t des_random_mutex;
+pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER;
 #define LOCK_RANDOM assert(pthread_mutex_lock(&des_random_mutex)==0)
 #define UNLOCK_RANDOM assert(pthread_mutex_unlock(&des_random_mutex)==0)
 #else
index 8955d6c..91e384c 100644 (file)
@@ -78,7 +78,7 @@ static fc_KeySchedule random_int32_schedule;
  */
 
 #include <assert.h>
-pthread_mutex_t rxkad_random_mutex;
+pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER;
 #define LOCK_RM assert(pthread_mutex_lock(&rxkad_random_mutex)==0)
 #define UNLOCK_RM assert(pthread_mutex_unlock(&rxkad_random_mutex)==0)
 #else