/* read-side C.S. duration, in loops */
static unsigned long wdelay;
/* read-side C.S. duration, in loops */
static unsigned long wdelay;
-static unsigned long long __thread nr_dequeues;
-static unsigned long long __thread nr_enqueues;
+static DEFINE_URCU_TLS(unsigned long long, nr_dequeues);
+static DEFINE_URCU_TLS(unsigned long long, nr_enqueues);
-static unsigned long long __thread nr_successful_dequeues;
-static unsigned long long __thread nr_successful_enqueues;
+static DEFINE_URCU_TLS(unsigned long long, nr_successful_dequeues);
+static DEFINE_URCU_TLS(unsigned long long, nr_successful_enqueues);
unsigned long long *count = _count;
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
unsigned long long *count = _count;
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", pthread_self(), (unsigned long)gettid());
+ "enqueuer", (unsigned long) pthread_self(),
+ (unsigned long) gettid());
printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
"enqueues %llu successful_enqueues %llu\n",
printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
"enqueues %llu successful_enqueues %llu\n",
- pthread_self(), (unsigned long)gettid(), nr_enqueues,
- nr_successful_enqueues);
+ pthread_self(),
+ (unsigned long) gettid(),
+ URCU_TLS(nr_enqueues), URCU_TLS(nr_successful_enqueues));
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", pthread_self(), (unsigned long)gettid());
+ "dequeuer", (unsigned long) pthread_self(),
+ (unsigned long) gettid());
- if (node) {
- defer_rcu(free, node);
- nr_successful_dequeues++;
+ 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)++;
printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
"dequeues %llu, successful_dequeues %llu\n",
printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
"dequeues %llu, successful_dequeues %llu\n",
- pthread_self(), (unsigned long)gettid(), nr_dequeues,
- nr_successful_dequeues);
- count[0] = nr_dequeues;
- count[1] = nr_successful_dequeues;
+ pthread_self(),
+ (unsigned long) gettid(),
+ URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues));
+ count[0] = URCU_TLS(nr_dequeues);
+ count[1] = URCU_TLS(nr_successful_dequeues);
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", pthread_self(), (unsigned long)gettid());
+ "main", (unsigned long) pthread_self(),
+ (unsigned long) gettid());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
cds_lfq_init_rcu(&q, call_rcu);
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers);
count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers);
cds_lfq_init_rcu(&q, call_rcu);