From: Mathieu Desnoyers Date: Mon, 28 Sep 2009 23:54:38 +0000 (-0400) Subject: urcu (signal/mb): move thread checks outside lock X-Git-Tag: v0.1~18 X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=812cadd78037278561f699aedc71c4429af67b0c urcu (signal/mb): move thread checks outside lock Done on local variables, no need to lock. Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu.c b/urcu.c index d441355..8e41d88 100644 --- a/urcu.c +++ b/urcu.c @@ -65,9 +65,6 @@ long urcu_gp_ctr = RCU_GP_COUNT; */ struct urcu_reader __thread urcu_reader; -/* Thread IDs of registered readers */ -#define INIT_NUM_THREADS 4 - #ifdef DEBUG_YIELD unsigned int yield_active; unsigned int __thread rand_yield; @@ -386,11 +383,12 @@ void *rcu_publish_content_sym(void **p, void *v) void rcu_register_thread(void) { - internal_urcu_lock(); - urcu_init(); /* In case gcc does not support constructor attribute */ urcu_reader.tid = pthread_self(); assert(urcu_reader.need_mb == 0); assert(urcu_reader.ctr == 0); + + internal_urcu_lock(); + urcu_init(); /* In case gcc does not support constructor attribute */ list_add(&urcu_reader.head, ®istry); internal_urcu_unlock(); }