X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_lfs.c;h=71596fdb3071b77123eb64c4069401ae77a96b01;hb=98bc124a1949657d6af385f8b257af3a58957e51;hp=8335f2459f1f05533da21d5f0cc557ef815e28d9;hpb=16aa9ee87cf4364921c36025359be01390338d87;p=urcu.git diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c index 8335f24..71596fd 100644 --- a/tests/test_urcu_lfs.c +++ b/tests/test_urcu_lfs.c @@ -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,13 +204,18 @@ 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()); set_affinity(); - rcu_defer_register_thread(); + ret = rcu_defer_register_thread(); + if (ret) { + printf("Error in rcu_defer_register_thread\n"); + exit(-1); + } rcu_register_thread(); while (!test_go) @@ -218,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;