X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=urcu%2Fstatic%2Furcu.h;h=b9933754e26fed2e7ddb823a25a389681d8506a2;hb=3a71751ee010b48e1a1fa7081617ec6f82d5c0ba;hp=18e4826a5a31789c7cb408832421cbddb7d83c22;hpb=af7c2dbeac32c663b64ad05e4eca70e18784463b;p=urcu.git diff --git a/urcu/static/urcu.h b/urcu/static/urcu.h index 18e4826..b993375 100644 --- a/urcu/static/urcu.h +++ b/urcu/static/urcu.h @@ -31,15 +31,15 @@ #include #include -#include #include +#include #include #include #include -#include +#include #include -#include +#include #ifdef __cplusplus extern "C" { @@ -50,9 +50,17 @@ extern "C" { #define RCU_MEMBARRIER #endif +/* + * RCU_MEMBARRIER is only possibly available on Linux. Fallback to RCU_MB + * otherwise. + */ +#if !defined(__linux__) && defined(RCU_MEMBARRIER) +#undef RCU_MEMBARRIER +#define RCU_MB +#endif + #ifdef RCU_MEMBARRIER -#include -#include +#include /* If the headers do not support SYS_membarrier, statically use RCU_MB */ #ifdef SYS_membarrier @@ -87,18 +95,6 @@ extern "C" { #define SIGRCU SIGUSR1 #endif -/* - * If a reader is really non-cooperative and refuses to commit its - * rcu_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 - -/* - * Active attempts to check for reader Q.S. before calling futex(). - */ -#define RCU_QS_ACTIVE_ATTEMPTS 100 - #ifdef DEBUG_RCU #define rcu_assert(args...) assert(args) #else @@ -143,7 +139,7 @@ static inline void debug_yield_write(void) static inline void debug_yield_init(void) { - rand_yield = time(NULL) ^ pthread_self(); + rand_yield = time(NULL) ^ (unsigned long) pthread_self(); } #else static inline void debug_yield_read(void) @@ -228,7 +224,7 @@ struct rcu_reader { extern struct rcu_reader __thread rcu_reader; -extern int gp_futex; +extern int32_t gp_futex; /* * Wake-up waiting synchronize_rcu(). Called from many concurrent threads.