Add missing memory barriers to ensure progress and remove an unnecessary ACCESS_ONCE
[urcu.git] / urcu.h
diff --git a/urcu.h b/urcu.h
index 03764ab33dbe241b643b72ef9cbfd6757662fa3b..c4a7992b4b7b166d527411d4ae5108cac174fc95 100644 (file)
--- a/urcu.h
+++ b/urcu.h
@@ -207,10 +207,14 @@ static inline int rcu_old_gp_ongoing(long *value)
        if (value == NULL)
                return 0;
        debug_yield_write();
+       /*
+        * Make sure both tests below are done on the same version of *value
+        * to insure consistency.
+        */
        v = ACCESS_ONCE(*value);
        debug_yield_write();
        return (v & RCU_GP_CTR_NEST_MASK) &&
-                ((v ^ ACCESS_ONCE(urcu_gp_ctr)) & RCU_GP_CTR_BIT);
+                ((v ^ urcu_gp_ctr) & RCU_GP_CTR_BIT);
 }
 
 static inline void rcu_read_lock(void)
This page took 0.022706 seconds and 4 git commands to generate.