projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix warnings in urcutorture and use access once in urch.u
[urcu.git]
/
urcu.h
diff --git
a/urcu.h
b/urcu.h
index 1b663c7ff1492e3beeab7832a592e6c2b7d90925..79d9464b0be63142fb51cb2f00d11edb5996441d 100644
(file)
--- a/
urcu.h
+++ b/
urcu.h
@@
-130,6
+130,13
@@
static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
#define SIGURCU SIGUSR1
#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 <sched.h>
#include <time.h>
#ifdef DEBUG_YIELD
#include <sched.h>
#include <time.h>
@@
-234,8
+241,10
@@
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) */
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)))
if (likely(!(tmp & RCU_GP_CTR_NEST_MASK)))
- urcu_active_readers =
urcu_gp_ctr
;
+ urcu_active_readers =
ACCESS_ONCE(urcu_gp_ctr)
;
else
urcu_active_readers = tmp + RCU_GP_COUNT;
/*
else
urcu_active_readers = tmp + RCU_GP_COUNT;
/*
This page took
0.022353 seconds
and
4
git commands to generate.