urcu-mb/signal/membarrier: move quiescent threads to separate list
[urcu.git] / urcu / static / urcu.h
index f32f300e599d95b922cbf043cc3a839e234190d5..973826a52bfa021423bbb8cce12545357d2df48b 100644 (file)
@@ -96,6 +96,12 @@ extern "C" {
 #define SIGRCU SIGUSR1
 #endif
 
+enum rcu_state {
+       RCU_READER_ACTIVE_CURRENT,
+       RCU_READER_ACTIVE_OLD,
+       RCU_READER_INACTIVE,
+};
+
 #ifdef DEBUG_RCU
 #define rcu_assert(args...)    assert(args)
 #else
@@ -239,7 +245,7 @@ static inline void wake_up_gp(void)
        }
 }
 
-static inline int rcu_gp_ongoing(unsigned long *ctr)
+static inline enum rcu_state rcu_reader_state(unsigned long *ctr)
 {
        unsigned long v;
 
@@ -248,8 +254,11 @@ static inline int rcu_gp_ongoing(unsigned long *ctr)
         * to insure consistency.
         */
        v = CMM_LOAD_SHARED(*ctr);
-       return (v & RCU_GP_CTR_NEST_MASK) &&
-                ((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE);
+       if (!(v & RCU_GP_CTR_NEST_MASK))
+               return RCU_READER_INACTIVE;
+       if (!((v ^ rcu_gp_ctr) & RCU_GP_CTR_PHASE))
+               return RCU_READER_ACTIVE_CURRENT;
+       return RCU_READER_ACTIVE_OLD;
 }
 
 /*
This page took 0.022947 seconds and 4 git commands to generate.