qsbr: use defines to clarify code.
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Fri, 18 Sep 2009 12:20:22 +0000 (08:20 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Fri, 18 Sep 2009 12:20:22 +0000 (08:20 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
urcu-qsbr-static.h
urcu-qsbr.c

index 3d2ec8f3af5b046c9ca66c3b24e4e77aa762d358..887dc3d64e949ab843a248846e4286b4fbdbf7bb 100644 (file)
@@ -161,6 +161,9 @@ static inline void reader_barrier()
        smp_mb();
 }
 
+#define RCU_GP_ONLINE          (1UL << 0)
+#define RCU_GP_COUNT           (1UL << 1)
+
 /*
  * Global quiescent period counter with low-order bits unused.
  * Using a int rather than a char to eliminate false register dependencies
@@ -182,7 +185,7 @@ static inline int rcu_gp_ongoing(unsigned long *value)
 
 static inline void _rcu_read_lock(void)
 {
-       rcu_assert(rcu_reader_qs_gp & 1);
+       rcu_assert(rcu_reader_qs_gp);
 }
 
 static inline void _rcu_read_unlock(void)
index c0e643dab54f460b59e3646ade4af850fd9d05fb..5f9e46dc28f6f88d11004c95acda61bd24643543 100644 (file)
@@ -42,7 +42,7 @@ pthread_mutex_t urcu_mutex = PTHREAD_MUTEX_INITIALIZER;
 /*
  * Global grace period counter.
  */
-unsigned long urcu_gp_ctr = 1;
+unsigned long urcu_gp_ctr = RCU_GP_ONLINE;
 
 /*
  * Written to only by each individual reader. Read by both the reader and the
@@ -153,7 +153,7 @@ void synchronize_rcu(void)
                STORE_SHARED(rcu_reader_qs_gp, 0);
 
        internal_urcu_lock();
-       STORE_SHARED(urcu_gp_ctr, urcu_gp_ctr + 2);
+       STORE_SHARED(urcu_gp_ctr, urcu_gp_ctr + RCU_GP_COUNT);
        wait_for_quiescent_state();
        internal_urcu_unlock();
 
This page took 0.036664 seconds and 4 git commands to generate.