X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu-qsbr-static.h;h=86f0fc507449451d70f276571d3c6aa1be61d98a;hp=2816621f7296d0203e0551d5010d48d9028cfd56;hb=0ecb3fde04135d76545ce55d80abea9aef465b54;hpb=02be55611d3b1c7bf4fdfcb3a9c98f621882d417 diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index 2816621..86f0fc5 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -121,11 +121,6 @@ static inline void debug_yield_init(void) } #endif -static inline void reader_barrier() -{ - smp_mb(); -} - #define RCU_GP_ONLINE (1UL << 0) #define RCU_GP_CTR (1UL << 1) @@ -140,7 +135,7 @@ struct rcu_reader { /* Data used by both reader and synchronize_rcu() */ unsigned long ctr; /* Data used for registry */ - struct list_head head __attribute__((aligned(CACHE_LINE_SIZE))); + struct list_head node __attribute__((aligned(CACHE_LINE_SIZE))); pthread_t tid; }; @@ -160,27 +155,13 @@ static inline void wake_up_gp(void) } } -#if (BITS_PER_LONG < 64) -static inline int rcu_gp_ongoing(unsigned long *value) -{ - unsigned long reader_gp; - - if (value == NULL) - return 0; - reader_gp = LOAD_SHARED(*value); - return reader_gp && ((reader_gp ^ rcu_gp_ctr) & RCU_GP_CTR); -} -#else /* !(BITS_PER_LONG < 64) */ -static inline int rcu_gp_ongoing(unsigned long *value) +static inline int rcu_gp_ongoing(unsigned long *ctr) { - unsigned long reader_gp; + unsigned long v; - if (value == NULL) - return 0; - reader_gp = LOAD_SHARED(*value); - return reader_gp && (reader_gp - rcu_gp_ctr > ULONG_MAX / 2); + v = LOAD_SHARED(*ctr); + return v && (v != rcu_gp_ctr); } -#endif /* !(BITS_PER_LONG < 64) */ static inline void _rcu_read_lock(void) {