doc: update examples to API changes
[urcu.git] / doc / examples / rculfhash / cds_lfht_add.c
index 8932e7acd2f8bfc84f71edf81bb4aa8b0de912de..acff676d81193fe2c739a0b36744b5c43d3825b5 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <time.h>
 
-#include <urcu.h>              /* RCU flavor */
+#include <urcu/urcu-memb.h>    /* RCU flavor */
 #include <urcu/rculfhash.h>    /* RCU Lock-free hash table */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 #include "jhash.h"             /* Example hash function */
@@ -46,7 +46,7 @@ int main(int argc, char **argv)
         * Each thread need using RCU read-side need to be explicitly
         * registered.
         */
-       rcu_register_thread();
+       urcu_memb_register_thread();
 
        /* Use time as seed for hash table hashing. */
        seed = (uint32_t) time(NULL);
@@ -54,9 +54,9 @@ int main(int argc, char **argv)
        /*
         * Allocate hash table.
         */
-       ht = cds_lfht_new(1, 1, 0,
+       ht = cds_lfht_new_flavor(1, 1, 0,
                CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
-               NULL);
+               &urcu_memb_flavor, NULL);
        if (!ht) {
                printf("Error allocating hash table\n");
                ret = -1;
@@ -83,9 +83,9 @@ int main(int argc, char **argv)
                 * cds_lfht_add() needs to be called from RCU read-side
                 * critical section.
                 */
-               rcu_read_lock();
+               urcu_memb_read_lock();
                cds_lfht_add(ht, hash, &node->node);
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
        /*
@@ -94,13 +94,13 @@ int main(int argc, char **argv)
         * be performed within RCU read-side critical section.
         */
        printf("hash table content (random order):");
-       rcu_read_lock();
+       urcu_memb_read_lock();
        cds_lfht_for_each_entry(ht, &iter, node, node) {
                printf(" %d", node->value);
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
        printf("\n");
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
This page took 0.025358 seconds and 4 git commands to generate.