tests: move yield debug to common test library
[urcu.git] / urcu / static / urcu-qsbr.h
index ef1f600d6c2248d3b1320b2056ef49b661660873..8f2ca32a2f111c4b1469c010c5f1fcb4669039a5 100644 (file)
@@ -68,58 +68,10 @@ 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)
 
-struct urcu_gp {
+struct rcu_gp {
        /*
         * Global quiescent period counter with low-order bits unused.
         * Using a int rather than a char to eliminate false register
@@ -130,7 +82,7 @@ struct urcu_gp {
        int32_t futex;
 } __attribute__((aligned(CAA_CACHE_LINE_SIZE)));
 
-extern struct urcu_gp rcu_gp;
+extern struct rcu_gp rcu_gp;
 
 struct rcu_reader {
        /* Data used by both reader and synchronize_rcu() */
This page took 0.023259 seconds and 4 git commands to generate.