X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_lfs.c;h=71229da4960c9e30ed34d511e37eb1cdb7f495d2;hb=376ba488819af938e059e45315913c2ff5ce2b50;hp=a1d6a1f063946a51ec27348dbdfc6748494d679f;hpb=6ade67d5cb23ae9e2c18e7c2a62e3202552fb9e2;p=urcu.git diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c index a1d6a1f..71229da 100644 --- a/tests/test_urcu_lfs.c +++ b/tests/test_urcu_lfs.c @@ -62,7 +62,7 @@ static inline pid_t gettid(void) #define _LGPL_SOURCE #endif #include -#include +#include #include static volatile int test_go, test_stop; @@ -177,6 +177,7 @@ void *thr_enqueuer(void *_count) if (!node) goto fail; cds_lfs_node_init_rcu(node); + /* No rcu read-side is needed for push */ cds_lfs_push_rcu(&s, node); nr_successful_enqueues++; @@ -203,6 +204,7 @@ fail: void *thr_dequeuer(void *_count) { unsigned long long *count = _count; + int ret; printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n", "dequeuer", pthread_self(), (unsigned long)gettid()); @@ -222,13 +224,15 @@ void *thr_dequeuer(void *_count) cmm_smp_mb(); for (;;) { - struct cds_lfs_node_rcu *node = cds_lfs_pop_rcu(&s); + struct cds_lfs_node_rcu *node; + rcu_read_lock(); + node = cds_lfs_pop_rcu(&s); + rcu_read_unlock(); if (node) { defer_rcu(free, node); nr_successful_dequeues++; } - nr_dequeues++; if (unlikely(!test_duration_dequeue())) break;