projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't __USE_GNU in urcu.h
[urcu.git]
/
test_urcu.c
diff --git
a/test_urcu.c
b/test_urcu.c
index 93bc013b4a3a3575e598ef10eb61096871db7aa1..b92a7d74de5c23fd55d5959e8e5f514d314ef090 100644
(file)
--- a/
test_urcu.c
+++ b/
test_urcu.c
@@
-88,7
+88,6
@@
void rcu_copy_mutex_unlock(void)
void *thr_reader(void *arg)
{
void *thr_reader(void *arg)
{
- int qparity;
struct test_array *local_ptr;
printf("thread_begin %s, thread id : %lx, tid %lu\n",
struct test_array *local_ptr;
printf("thread_begin %s, thread id : %lx, tid %lu\n",
@@
-97,11
+96,11
@@
void *thr_reader(void *arg)
urcu_register_thread();
for (;;) {
urcu_register_thread();
for (;;) {
- rcu_read_lock(
&qparity
);
+ rcu_read_lock();
local_ptr = rcu_dereference(test_rcu_pointer);
if (local_ptr)
assert(local_ptr->a == 8);
local_ptr = rcu_dereference(test_rcu_pointer);
if (local_ptr)
assert(local_ptr->a == 8);
- rcu_read_unlock(
&qparity
);
+ rcu_read_unlock();
if (!test_duration())
break;
}
if (!test_duration())
break;
}
@@
-128,7
+127,7
@@
void *thr_writer(void *arg)
if (old)
assert(old->a == 8);
new->a = 8;
if (old)
assert(old->a == 8);
new->a = 8;
- old = urcu_publish_content(
(void **)
&test_rcu_pointer, new);
+ old = urcu_publish_content(&test_rcu_pointer, new);
rcu_copy_mutex_unlock();
/* can be done after unlock */
if (old)
rcu_copy_mutex_unlock();
/* can be done after unlock */
if (old)
@@
-144,6
+143,15
@@
void *thr_writer(void *arg)
return ((void*)2);
}
return ((void*)2);
}
+void show_usage(int argc, char **argv)
+{
+ printf("Usage : %s duration (s)", argv[0]);
+#ifdef DEBUG_YIELD
+ printf(" [-r] [-w] (yield reader and/or writer)");
+#endif
+ printf("\n");
+}
+
int main(int argc, char **argv)
{
int err;
int main(int argc, char **argv)
{
int err;
@@
-152,15
+160,13
@@
int main(int argc, char **argv)
int i;
if (argc < 2) {
int i;
if (argc < 2) {
- printf("Usage : %s duration (s) [-r] [-w] "
- "(yield reader and/or writer)\n", argv[0]);
+ show_usage(argc, argv);
return -1;
}
err = sscanf(argv[1], "%lu", &duration);
if (err != 1) {
return -1;
}
err = sscanf(argv[1], "%lu", &duration);
if (err != 1) {
- printf("Usage : %s duration (s) [-r] [-w] "
- "(yield reader and/or writer)\n", argv[0]);
+ show_usage(argc, argv);
return -1;
}
return -1;
}
This page took
0.024405 seconds
and
4
git commands to generate.