Permalink
Browse files

better static mutex initialization (thanks Vincent)

  • Loading branch information...
1 parent d1d50ef commit 3b5da11caadf3de077bb2c6e0f0116188b6e1393 Laurent Sansonetti committed Jul 6, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 symbol.c
View
@@ -18,7 +18,7 @@
VALUE rb_cSymbol;
-static pthread_mutex_t local_lock;
+static pthread_mutex_t local_lock = PTHREAD_MUTEX_INITIALIZER;
#define LOCK() (assert(pthread_mutex_lock(&local_lock) == 0))
#define UNLOCK() (assert(pthread_mutex_unlock(&local_lock) == 0))
@@ -301,7 +301,6 @@ struct rb_op_tbl_entry rb_op_tbl[] = {
void
Init_PreSymbol(void)
{
- assert(pthread_mutex_init(&local_lock, 0) == 0);
sym_id = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
assert(sym_id != NULL);
id_str = CFDictionaryCreateMutable(NULL, 0, NULL,

0 comments on commit 3b5da11

Please sign in to comment.