projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add randomness to yield debug test
[urcu.git]
/
urcu.h
diff --git
a/urcu.h
b/urcu.h
index 2aa35977036d9432884206983c21b6bc686b9cf0..c77b26f958e34b8521f1b8363d83b6492cb46b0f 100644
(file)
--- a/
urcu.h
+++ b/
urcu.h
@@
-72,18
+72,26
@@
static inline void atomic_inc(int *v)
#define YIELD_READ (1 << 0)
#define YIELD_WRITE (1 << 1)
#define YIELD_READ (1 << 0)
#define YIELD_WRITE (1 << 1)
-extern int yield_active;
+extern unsigned int yield_active;
+extern unsigned int __thread rand_yield;
static inline void debug_yield_read(void)
{
if (yield_active & YIELD_READ)
static inline void debug_yield_read(void)
{
if (yield_active & YIELD_READ)
- sched_yield();
+ if (rand_r(&rand_yield) & 0x1)
+ sched_yield();
}
static inline void debug_yield_write(void)
{
if (yield_active & YIELD_WRITE)
}
static inline void debug_yield_write(void)
{
if (yield_active & YIELD_WRITE)
- sched_yield();
+ if (rand_r(&rand_yield) & 0x1)
+ sched_yield();
+}
+
+static inline void debug_yield_init(void)
+{
+ rand_yield = time(NULL) ^ pthread_self();
}
#else
static inline void debug_yield_read(void)
}
#else
static inline void debug_yield_read(void)
@@
-92,6
+100,11
@@
static inline void debug_yield_read(void)
static inline void debug_yield_write(void)
{
static inline void debug_yield_write(void)
{
+}
+
+static inline void debug_yield_init(void)
+{
+
}
#endif
}
#endif
This page took
0.024234 seconds
and
4
git commands to generate.