RCU dereference check if within read-side critical section
[urcu.git] / urcu / static / urcu-qsbr.h
index 690b77d528c38ef173aa1da91fc1d39dad0fed94..1ef830aba1833fa888ebdfa3ee4daa1034cbdf8c 100644 (file)
@@ -43,6 +43,7 @@
 #include <urcu/list.h>
 #include <urcu/futex.h>
 #include <urcu/tls-compat.h>
+#include <urcu/urcu-checker.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -68,54 +69,6 @@ enum rcu_state {
        RCU_READER_INACTIVE,
 };
 
-#ifdef DEBUG_YIELD
-#include <sched.h>
-#include <time.h>
-#include <pthread.h>
-#include <unistd.h>
-
-#define RCU_YIELD_READ         (1 << 0)
-#define RCU_YIELD_WRITE        (1 << 1)
-
-/* maximum sleep delay, in us */
-#define MAX_SLEEP 50
-
-extern unsigned int rcu_yield_active;
-extern DECLARE_URCU_TLS(unsigned int, rcu_rand_yield);
-
-static inline void rcu_debug_yield_read(void)
-{
-       if (rcu_yield_active & RCU_YIELD_READ)
-               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
-}
-
-static inline void rcu_debug_yield_write(void)
-{
-       if (rcu_yield_active & RCU_YIELD_WRITE)
-               if (rand_r(&URCU_TLS(rcu_rand_yield)) & 0x1)
-                       usleep(rand_r(&URCU_TLS(rcu_rand_yield)) % MAX_SLEEP);
-}
-
-static inline void rcu_debug_yield_init(void)
-{
-       URCU_TLS(rcu_rand_yield) = time(NULL) ^ (unsigned long) pthread_self();
-}
-#else
-static inline void rcu_debug_yield_read(void)
-{
-}
-
-static inline void rcu_debug_yield_write(void)
-{
-}
-
-static inline void rcu_debug_yield_init(void)
-{
-
-}
-#endif
-
 #define RCU_GP_ONLINE          (1UL << 0)
 #define RCU_GP_CTR             (1UL << 1)
 
@@ -180,6 +133,7 @@ static inline enum rcu_state rcu_reader_state(unsigned long *ctr)
  */
 static inline void _rcu_read_lock(void)
 {
+       rcu_read_lock_debug();
        rcu_assert(URCU_TLS(rcu_reader).ctr);
 }
 
@@ -192,6 +146,7 @@ static inline void _rcu_read_lock(void)
  */
 static inline void _rcu_read_unlock(void)
 {
+       rcu_read_unlock_debug();
 }
 
 /*
This page took 0.023453 seconds and 4 git commands to generate.