X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_lfs.c;h=8c28c2ba4708f7d631241ee312556e1c03c6c3fb;hb=69328034b804a0fc180c08f7ca6be1a4446bb105;hp=5886ce86de50c1ab2c25c61a172d895fa4a33a53;hpb=ab0aacbe1a25d50d069f0b24aa492e84ea296f57;p=urcu.git diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c index 5886ce8..8c28c2b 100644 --- a/tests/test_urcu_lfs.c +++ b/tests/test_urcu_lfs.c @@ -67,7 +67,6 @@ static inline pid_t gettid(void) #endif #include #include -#include static volatile int test_go, test_stop; @@ -106,9 +105,10 @@ typedef unsigned long cpu_set_t; static void set_affinity(void) { +#if HAVE_SCHED_SETAFFINITY cpu_set_t mask; - int cpu; - int ret; + int cpu, ret; +#endif /* HAVE_SCHED_SETAFFINITY */ if (!use_affinity) return; @@ -221,18 +221,12 @@ void free_node_cb(struct rcu_head *head) 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(); - ret = rcu_defer_register_thread(); - if (ret) { - printf("Error in rcu_defer_register_thread\n"); - exit(-1); - } rcu_register_thread(); while (!test_go) @@ -242,13 +236,14 @@ void *thr_dequeuer(void *_count) for (;;) { struct cds_lfs_node_rcu *snode; - struct test *node; rcu_read_lock(); snode = cds_lfs_pop_rcu(&s); - node = caa_container_of(snode, struct test, list); rcu_read_unlock(); - if (node) { + if (snode) { + struct test *node; + + node = caa_container_of(snode, struct test, list); call_rcu(&node->rcu, free_node_cb); URCU_TLS(nr_successful_dequeues)++; } @@ -260,7 +255,6 @@ void *thr_dequeuer(void *_count) } rcu_unregister_thread(); - rcu_defer_unregister_thread(); printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, " "dequeues %llu, successful_dequeues %llu\n",