X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu.h;h=3eca5ea3c44ccc7135635229c41141d5050df1e2;hp=1b663c7ff1492e3beeab7832a592e6c2b7d90925;hb=40e140c9f237bbe8c50d4a5355561139f01afb70;hpb=ae878d0dcc291dba7c5722eed13294195a64409e diff --git a/urcu.h b/urcu.h index 1b663c7..3eca5ea 100644 --- a/urcu.h +++ b/urcu.h @@ -130,6 +130,13 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, #define SIGURCU SIGUSR1 +/* + * If a reader is really non-cooperative and refuses to commit its + * urcu_active_readers count to memory (there is no barrier in the reader + * per-se), kick it after a few loops waiting for it. + */ +#define KICK_READER_LOOPS 10000 + #ifdef DEBUG_YIELD #include #include @@ -234,6 +241,8 @@ static inline void rcu_read_lock(void) tmp = urcu_active_readers; /* urcu_gp_ctr = RCU_GP_COUNT | (~RCU_GP_CTR_BIT or RCU_GP_CTR_BIT) */ + /* The data dependency "read urcu_gp_ctr, write urcu_active_readers", + * serializes those two memory operations. */ if (likely(!(tmp & RCU_GP_CTR_NEST_MASK))) urcu_active_readers = urcu_gp_ctr; else