lfstack: implement test
[urcu.git] / tests / test_urcu_lfs.c
index 8c28c2ba4708f7d631241ee312556e1c03c6c3fb..9af846d1c782a724caeb41306e39aa29352ac0c4 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * 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
@@ -159,11 +159,11 @@ static unsigned int nr_enqueuers;
 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)
 {
@@ -185,9 +185,8 @@ 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))
@@ -235,10 +234,10 @@ void *thr_dequeuer(void *_count)
        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;
@@ -265,12 +264,12 @@ void *thr_dequeuer(void *_count)
        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;
 
@@ -372,7 +371,7 @@ int main(int argc, char **argv)
        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");
This page took 0.023694 seconds and 4 git commands to generate.