projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into urcu/ht-shrink
[urcu.git]
/
tests
/
test_rwlock.c
diff --git
a/tests/test_rwlock.c
b/tests/test_rwlock.c
index 1c65fca9198247d883525f5d881bcbdb6800b2c9..34d8c0727b271aab00241173154c9c8f825fc4a1 100644
(file)
--- a/
tests/test_rwlock.c
+++ b/
tests/test_rwlock.c
@@
-31,12
+31,15
@@
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
-#include <sys/syscall.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
#include <sched.h>
#include <errno.h>
#include <urcu/arch.h>
+#ifdef __linux__
+#include <syscall.h>
+#endif
+
/* hardcoded number of CPUs */
#define NR_CPUS 16384
/* hardcoded number of CPUs */
#define NR_CPUS 16384
@@
-85,7
+88,7
@@
static unsigned long wduration;
static inline void loop_sleep(unsigned long l)
{
while(l-- != 0)
static inline void loop_sleep(unsigned long l)
{
while(l-- != 0)
- cpu_relax();
+ c
aa_c
pu_relax();
}
static int verbose_mode;
}
static int verbose_mode;
@@
-198,11
+201,11
@@
void *thr_reader(void *_count)
for (;;) {
pthread_rwlock_rdlock(&lock);
assert(test_array.a == 8);
for (;;) {
pthread_rwlock_rdlock(&lock);
assert(test_array.a == 8);
- if (unlikely(rduration))
+ if (
caa_
unlikely(rduration))
loop_sleep(rduration);
pthread_rwlock_unlock(&lock);
nr_reads++;
loop_sleep(rduration);
pthread_rwlock_unlock(&lock);
nr_reads++;
- if (unlikely(!test_duration_read()))
+ if (
caa_
unlikely(!test_duration_read()))
break;
}
break;
}
@@
-225,19
+228,19
@@
void *thr_writer(void *_count)
while (!test_go)
{
}
while (!test_go)
{
}
- smp_mb();
+
cmm_
smp_mb();
for (;;) {
pthread_rwlock_wrlock(&lock);
test_array.a = 0;
test_array.a = 8;
for (;;) {
pthread_rwlock_wrlock(&lock);
test_array.a = 0;
test_array.a = 8;
- if (unlikely(wduration))
+ if (
caa_
unlikely(wduration))
loop_sleep(wduration);
pthread_rwlock_unlock(&lock);
nr_writes++;
loop_sleep(wduration);
pthread_rwlock_unlock(&lock);
nr_writes++;
- if (unlikely(!test_duration_write()))
+ if (
caa_
unlikely(!test_duration_write()))
break;
break;
- if (unlikely(wdelay))
+ if (
caa_
unlikely(wdelay))
loop_sleep(wdelay);
}
loop_sleep(wdelay);
}
@@
-274,7
+277,7
@@
int main(int argc, char **argv)
show_usage(argc, argv);
return -1;
}
show_usage(argc, argv);
return -1;
}
- smp_mb();
+
cmm_
smp_mb();
err = sscanf(argv[1], "%u", &nr_readers);
if (err != 1) {
err = sscanf(argv[1], "%u", &nr_readers);
if (err != 1) {
@@
-370,7
+373,7
@@
int main(int argc, char **argv)
exit(1);
}
exit(1);
}
- smp_mb();
+
cmm_
smp_mb();
test_go = 1;
test_go = 1;
This page took
0.024583 seconds
and
4
git commands to generate.