X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=urcu%2Fstatic%2Furcu-qsbr.h;h=143d75a7e1e047f0ec2f81709f3ca39175debdab;hb=b0a841b4ff807dd29fe0cdbfe24900312f0e627b;hp=ef1f600d6c2248d3b1320b2056ef49b661660873;hpb=15302e2854ad9f1377ec81e331c1bec7a54a5621;p=urcu.git diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h index ef1f600..143d75a 100644 --- a/urcu/static/urcu-qsbr.h +++ b/urcu/static/urcu-qsbr.h @@ -68,58 +68,10 @@ enum rcu_state { RCU_READER_INACTIVE, }; -#ifdef DEBUG_YIELD -#include -#include -#include -#include - -#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() */ @@ -154,8 +106,13 @@ static inline void wake_up_gp(void) if (uatomic_read(&rcu_gp.futex) != -1) return; uatomic_set(&rcu_gp.futex, 0); - futex_noasync(&rcu_gp.futex, FUTEX_WAKE, 1, - NULL, NULL, 0); + /* + * Ignoring return value until we can make this function + * return something (because urcu_die() is not publicly + * exposed). + */ + (void) futex_noasync(&rcu_gp.futex, FUTEX_WAKE, 1, + NULL, NULL, 0); } }