From: Mathieu Desnoyers Date: Mon, 8 Feb 2010 14:36:41 +0000 (-0500) Subject: standardize rcu_gp_ongoing X-Git-Tag: v0.4.1~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e26fa029fb2db4c2f3746a3bfe46e9a0eeeb41a7;p=urcu.git standardize rcu_gp_ongoing Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index 7cef820..9f3a9b9 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -156,24 +156,20 @@ static inline void wake_up_gp(void) } #if (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) & RCU_GP_CTR); + v = LOAD_SHARED(*ctr); + return v && ((v ^ 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 > ULONG_MAX / 2); } #endif /* !(BITS_PER_LONG < 64) */ diff --git a/urcu-static.h b/urcu-static.h index 1eeb2e6..504febb 100644 --- a/urcu-static.h +++ b/urcu-static.h @@ -242,17 +242,15 @@ static inline void wake_up_gp(void) } } -static inline int rcu_gp_ongoing(unsigned long *value) +static inline int rcu_gp_ongoing(unsigned long *ctr) { unsigned long v; - if (value == NULL) - return 0; /* * Make sure both tests below are done on the same version of *value * to insure consistency. */ - v = LOAD_SHARED(*value); + v = LOAD_SHARED(*ctr); return (v & RCU_GP_CTR_NEST_MASK) && ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE); }