#endif
#include <urcu.h>
#include <urcu/cds.h>
-#include <urcu-defer.h>
static volatile int test_go, test_stop;
/* read-side C.S. duration, in loops */
static unsigned long wdelay;
-static inline void loop_sleep(unsigned long l)
+static inline void loop_sleep(unsigned long loops)
{
- while(l-- != 0)
+ while (loops-- != 0)
caa_cpu_relax();
}
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;
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)
for (;;) {
struct cds_lfq_node_rcu *qnode;
- struct test *node;
rcu_read_lock();
qnode = cds_lfq_dequeue_rcu(&q);
- node = caa_container_of(qnode, struct test, list);
rcu_read_unlock();
- if (node) {
+ if (qnode) {
+ struct test *node;
+
+ node = caa_container_of(qnode, struct test, list);
call_rcu(&node->rcu, free_node_cb);
URCU_TLS(nr_successful_dequeues)++;
}
}
rcu_unregister_thread();
- rcu_defer_unregister_thread();
printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
"dequeues %llu, successful_dequeues %llu\n",
pthread_self(), (unsigned long)gettid(),