/*
* test_urcu_lfs.c
*
- * Userspace RCU library - example RCU-based lock-free stack
+ * Userspace RCU library - example lock-free stack
*
- * Copyright February 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright 2010-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright February 2010 - Paolo Bonzini <pbonzini@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
static unsigned int nr_dequeuers;
struct test {
- struct cds_lfs_node_rcu list;
+ struct cds_lfs_node list;
struct rcu_head rcu;
};
-static struct cds_lfs_stack_rcu s;
+static struct cds_lfs_stack s;
void *thr_enqueuer(void *_count)
{
struct test *node = malloc(sizeof(*node));
if (!node)
goto fail;
- cds_lfs_node_init_rcu(&node->list);
- /* No rcu read-side is needed for push */
- cds_lfs_push_rcu(&s, &node->list);
+ cds_lfs_node_init(&node->list);
+ cds_lfs_push(&s, &node->list);
URCU_TLS(nr_successful_enqueues)++;
if (caa_unlikely(wdelay))
cmm_smp_mb();
for (;;) {
- struct cds_lfs_node_rcu *snode;
+ struct cds_lfs_node *snode;
rcu_read_lock();
- snode = cds_lfs_pop_rcu(&s);
+ snode = cds_lfs_pop(&s);
rcu_read_unlock();
if (snode) {
struct test *node;
return ((void*)2);
}
-void test_end(struct cds_lfs_stack_rcu *s, unsigned long long *nr_dequeues)
+void test_end(struct cds_lfs_stack *s, unsigned long long *nr_dequeues)
{
- struct cds_lfs_node_rcu *snode;
+ struct cds_lfs_node *snode;
do {
- snode = cds_lfs_pop_rcu(s);
+ snode = cds_lfs_pop(s);
if (snode) {
struct test *node;
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_lfs_init_rcu(&s);
+ cds_lfs_init(&s);
err = create_all_cpu_call_rcu_data(0);
if (err) {
printf("Per-CPU call_rcu() worker threads unavailable. Using default global worker thread.\n");