urcu (signal/mb): move thread checks outside lock
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 28 Sep 2009 23:54:38 +0000 (19:54 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 28 Sep 2009 23:54:38 +0000 (19:54 -0400)
Done on local variables, no need to lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu.c

diff --git a/urcu.c b/urcu.c
index d441355e8a85b85a814c778f52acba7edb47ea2b..8e41d8805c8baaacc9851bec1c1643aaa2f2f056 100644 (file)
--- 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, &registry);
        internal_urcu_unlock();
 }
This page took 0.026189 seconds and 4 git commands to generate.