]> git.lttng.org Git - userspace-rcu.git/commitdiff
doc: update examples to API changes
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 29 Nov 2018 20:59:18 +0000 (15:59 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 12 Dec 2018 15:18:49 +0000 (10:18 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
24 files changed:
doc/examples/hlist/cds_hlist_add_head_rcu.c
doc/examples/hlist/cds_hlist_del_rcu.c
doc/examples/hlist/cds_hlist_for_each_entry_rcu.c
doc/examples/hlist/cds_hlist_for_each_rcu.c
doc/examples/list/cds_list_add_rcu.c
doc/examples/list/cds_list_add_tail_rcu.c
doc/examples/list/cds_list_del_rcu.c
doc/examples/list/cds_list_for_each_entry_rcu.c
doc/examples/list/cds_list_for_each_rcu.c
doc/examples/list/cds_list_replace_rcu.c
doc/examples/rculfhash/cds_lfht_add.c
doc/examples/rculfhash/cds_lfht_add_replace.c
doc/examples/rculfhash/cds_lfht_add_unique.c
doc/examples/rculfhash/cds_lfht_del.c
doc/examples/rculfhash/cds_lfht_destroy.c
doc/examples/rculfhash/cds_lfht_for_each_entry_duplicate.c
doc/examples/rculfhash/cds_lfht_lookup.c
doc/examples/rculfqueue/cds_lfq_dequeue.c
doc/examples/rculfqueue/cds_lfq_enqueue.c
doc/examples/urcu-flavors/bp.c
doc/examples/urcu-flavors/mb.c
doc/examples/urcu-flavors/membarrier.c
doc/examples/urcu-flavors/qsbr.c
doc/examples/urcu-flavors/signal.c

index 12161d1d4a792df02460508b6e2add82561156b0..bfe71c4263680bdf8b81132908d191699c197535 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rcuhlist.h>     /* RCU hlist */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
index 1995b215cf24e505daa262d935561aa042f545b0..2c0008eefb2b791e204d337f21c203756dbb85d7 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rcuhlist.h>     /* RCU hlist */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
                         * We can only reclaim memory after a grace
                         * period has passed after cds_hlist_del_rcu().
                         */
-                       call_rcu(&node->rcu_head, free_node_rcu);
+                       urcu_memb_call_rcu(&node->rcu_head, free_node_rcu);
                }
        }
 
index f6b744a353d139b1ab728474000986fcf10971c0..5f8fa72fd3d01fb9227c0cdc8faec9d8fd51521f 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rcuhlist.h>     /* RCU hlist */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -40,7 +40,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();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
         * Surround the RCU read-side critical section with rcu_read_lock()
         * and rcu_read_unlock().
         */
-       rcu_read_lock();
+       urcu_memb_read_lock();
 
        /*
         * This traversal can be performed concurrently with RCU
@@ -75,10 +75,10 @@ int main(int argc, char **argv)
                printf(" %d", node->value);
        }
 
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
 
        printf("\n");
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index 47baa0e88db9da7709233e553f55f47e9269d52b..fe31b54108cecc3eea6f1cb257a438fd507e06cb 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rcuhlist.h>     /* RCU hlist */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -43,7 +43,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();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
         * Surround the RCU read-side critical section with rcu_read_lock()
         * and rcu_read_unlock().
         */
-       rcu_read_lock();
+       urcu_memb_read_lock();
 
        /*
         * This traversal can be performed concurrently with RCU
@@ -82,10 +82,10 @@ int main(int argc, char **argv)
                printf(" %d", node->value);
        }
 
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
 
        printf("\n");
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index ad1d909cb7135d928dda85218e3e5ca3e64e3336..4235d251ee04327f80a012ea458b13713cd5bf00 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rculist.h>      /* RCU list */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
index 53784c9a167071ee0d9333b3984ee9ed22b5ae5f..653da6cfc48fdc5540091970caf3b335cc09fb30 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rculist.h>      /* RCU list */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
index c35510136f07a8b2ed6469a52fb1386b8992b365..1f4265c73e82fd9342de9049bef577c3acc95f15 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rculist.h>      /* RCU list */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -72,7 +72,7 @@ int main(int argc, char **argv)
                         * We can only reclaim memory after a grace
                         * period has passed after cds_list_del_rcu().
                         */
-                       call_rcu(&node->rcu_head, free_node_rcu);
+                       urcu_memb_call_rcu(&node->rcu_head, free_node_rcu);
                }
        }
 
index 777542b772b3b22229f092bdaff0b291594d3c47..6e4f7d6533f2db10322387592fbac0afea8cf8cb 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rculist.h>      /* RCU list */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -40,7 +40,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();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -62,10 +62,10 @@ int main(int argc, char **argv)
        printf("mylist content:");
 
        /*
-        * Surround the RCU read-side critical section with rcu_read_lock()
-        * and rcu_read_unlock().
+        * Surround the RCU read-side critical section with urcu_memb_read_lock()
+        * and urcu_memb_read_unlock().
         */
-       rcu_read_lock();
+       urcu_memb_read_lock();
 
        /*
         * This traversal can be performed concurrently with RCU
@@ -75,10 +75,10 @@ int main(int argc, char **argv)
                printf(" %d", node->value);
        }
 
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
 
        printf("\n");
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index 86cc4abf1c2d878abab7481f0981eb0954258ea2..12d5c4d80971e53449f972d87dc17a7c5777463f 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rculist.h>      /* RCU list */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -42,7 +42,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();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -66,10 +66,10 @@ int main(int argc, char **argv)
        printf("mylist content:");
 
        /*
-        * Surround the RCU read-side critical section with rcu_read_lock()
-        * and rcu_read_unlock().
+        * Surround the RCU read-side critical section with urcu_memb_read_lock()
+        * and urcu_memb_read_unlock().
         */
-       rcu_read_lock();
+       urcu_memb_read_lock();
 
        /*
         * This traversal can be performed concurrently with RCU
@@ -81,10 +81,10 @@ int main(int argc, char **argv)
                printf(" %d", node->value);
        }
 
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
 
        printf("\n");
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index 4ccc1df0038e583be8ea57a2b30e420a78d5654f..39202ea9f41da34a652664988c2d8dc3bf99fab2 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <stdio.h>
 
-#include <urcu.h>              /* Userspace RCU flavor */
+#include <urcu/urcu-memb.h>    /* Userspace RCU flavor */
 #include <urcu/rculist.h>      /* RCU list */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
                /* Replacement node value is negated original value. */
                new_node->value = -node->value;
                cds_list_replace_rcu(&node->node, &new_node->node);
-               call_rcu(&node->rcu_head, free_node_rcu);
+               urcu_memb_call_rcu(&node->rcu_head, free_node_rcu);
        }
 
        /*
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;
 }
index 62de40c033f97feca95c25b456c4bb1caa16714d..19c372675706d9ea7c74775480cd1574d5cdbb50 100644 (file)
@@ -21,7 +21,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 */
@@ -69,7 +69,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);
@@ -77,9 +77,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;
@@ -109,7 +109,7 @@ 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();
                ht_node = cds_lfht_add_replace(ht, hash, match, &value,
                        &node->node);
                if (ht_node) {
@@ -119,12 +119,12 @@ int main(int argc, char **argv)
                        printf("Replaced node (key: %d, seqnum: %d) by (key: %d, seqnum: %d)\n",
                                ret_node->value, ret_node->seqnum,
                                node->value, node->seqnum);
-                       call_rcu(&ret_node->rcu_head, free_node);
+                       urcu_memb_call_rcu(&ret_node->rcu_head, free_node);
                } else {
                        printf("Add (key: %d, seqnum: %d)\n",
                                node->value, node->seqnum);
                }
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
        /*
@@ -133,15 +133,15 @@ 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(" (key: %d, seqnum: %d)",
                        node->value, node->seqnum);
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
        printf("\n");
 
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index f1a7631d5a4cd5a35522e87754632ecfc1b65d3c..68759713c44c608a19b8c5e48d3fd61c995e5595 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 */
@@ -58,7 +58,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);
@@ -66,9 +66,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;
@@ -98,7 +98,7 @@ 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();
                ht_node = cds_lfht_add_unique(ht, hash, match, &value,
                        &node->node);
                /*
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
                        printf("Add (key: %d, seqnum: %d)\n",
                                node->value, node->seqnum);
                }
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
        /*
@@ -130,15 +130,15 @@ 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(" (key: %d, seqnum: %d)",
                        node->value, node->seqnum);
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
        printf("\n");
 
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index 4bcf15cd7b2d8facc22df5253eedf9e0bce74f1f..efa6d9a705323123a5e68384a253f51f0c1c1c11 100644 (file)
@@ -18,7 +18,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 */
@@ -66,7 +66,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);
@@ -74,9 +74,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;
@@ -105,9 +105,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();
        }
 
        /*
@@ -116,11 +116,11 @@ 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");
 
        /*
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
                value = remove_values[i];
                hash = jhash(&value, sizeof(value), seed);
                printf(" %d", value);
-               rcu_read_lock();
+               urcu_memb_read_lock();
                cds_lfht_lookup(ht, hash, match, &value, &iter);
                ht_node = cds_lfht_iter_get_node(&iter);
                if (ht_node) {
@@ -145,24 +145,24 @@ int main(int argc, char **argv)
                                struct mynode *del_node =
                                        caa_container_of(ht_node,
                                                struct mynode, node);
-                               call_rcu(&del_node->rcu_head, free_node);
+                               urcu_memb_call_rcu(&del_node->rcu_head, free_node);
                        }
                } else {
                        printf(" (not found)");
                }
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
        printf("\n");
 
        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;
 }
index d82d81c157858e55a879098a0893d5b2147aa1ff..1c723a56895e9096791817029779332cd4b4f8d1 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 */
@@ -56,7 +56,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);
@@ -64,9 +64,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;
@@ -95,9 +95,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();
        }
 
        /*
@@ -106,11 +106,11 @@ 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");
 
 
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
         * Make sure all hash table nodes are removed before destroying.
         */
        printf("removing all nodes:");
-       rcu_read_lock();
+       urcu_memb_read_lock();
        cds_lfht_for_each_entry(ht, &iter, node, node) {
                ht_node = cds_lfht_iter_get_node(&iter);
                ret = cds_lfht_del(ht, ht_node);
@@ -126,10 +126,10 @@ int main(int argc, char **argv)
                if (ret) {
                        printf(" (concurrently deleted)");
                } else {
-                       call_rcu(&node->rcu_head, free_node);
+                       urcu_memb_call_rcu(&node->rcu_head, free_node);
                }
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
        printf("\n");
 
        /*
@@ -144,6 +144,6 @@ int main(int argc, char **argv)
                printf("Destroying hash table failed\n");
        }
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index e57509dc44ce2b8008c8e7df12449e802502d158..98332803fa606ce1fb949dcd8baf164d5a064372 100644 (file)
@@ -18,7 +18,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 */
@@ -57,7 +57,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);
@@ -65,9 +65,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;
@@ -97,11 +97,11 @@ 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);
                printf("Add (key: %d, seqnum: %d)\n",
                        node->value, node->seqnum);
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
        /*
@@ -110,12 +110,12 @@ 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(" (key: %d, seqnum: %d)",
                        node->value, node->seqnum);
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
        printf("\n");
 
        /*
@@ -128,16 +128,16 @@ int main(int argc, char **argv)
                unsigned long hash = jhash(&value, sizeof(value), seed);
 
                printf("lookup key: %d\n", value);
-               rcu_read_lock();
+               urcu_memb_read_lock();
                cds_lfht_for_each_entry_duplicate(ht, hash, match,
                                &value, &iter, node, node) {
                        printf("        (key %d, seqnum %d) found\n",
                                node->value, node->seqnum);
                }
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index e76827b881d8e80c432357a96f73c930b63f2700..053e6dd9079a0fd090a8c25704d79e58b82bd72b 100644 (file)
@@ -18,7 +18,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 */
@@ -58,7 +58,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);
@@ -66,9 +66,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;
@@ -98,11 +98,11 @@ 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);
                printf("Add (key: %d, seqnum: %d)\n",
                        node->value, node->seqnum);
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
        /*
@@ -111,12 +111,12 @@ 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(" (key: %d, seqnum: %d)",
                        node->value, node->seqnum);
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
        printf("\n");
 
        /*
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
                int value = lookup_values[i];
                unsigned long hash = jhash(&value, sizeof(value), seed);
 
-               rcu_read_lock();
+               urcu_memb_read_lock();
                cds_lfht_lookup(ht, hash, match, &value, &iter);
                ht_node = cds_lfht_iter_get_node(&iter);
                if (!ht_node) {
@@ -138,10 +138,10 @@ int main(int argc, char **argv)
                        printf("(key %d, seqnum %d) found\n",
                                node->value, node->seqnum);
                }
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index d1375c8f2c65eea93b72afbb7dd5aa9016b850e8..fc8053cee05bab19cde28c1b4f98ada105948fad 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <urcu.h>              /* RCU flavor */
+#include <urcu/urcu-memb.h>    /* RCU flavor */
 #include <urcu/rculfqueue.h>   /* RCU Lock-free queue */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -50,9 +50,9 @@ 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();
 
-       cds_lfq_init_rcu(&myqueue, call_rcu);
+       cds_lfq_init_rcu(&myqueue, urcu_memb_call_rcu);
 
        /*
         * Enqueue nodes.
@@ -72,9 +72,9 @@ int main(int argc, char **argv)
                 * Both enqueue and dequeue need to be called within RCU
                 * read-side critical section.
                 */
-               rcu_read_lock();
+               urcu_memb_read_lock();
                cds_lfq_enqueue_rcu(&myqueue, &node->node);
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
        /*
@@ -90,16 +90,16 @@ int main(int argc, char **argv)
                 * Both enqueue and dequeue need to be called within RCU
                 * read-side critical section.
                 */
-               rcu_read_lock();
+               urcu_memb_read_lock();
                qnode = cds_lfq_dequeue_rcu(&myqueue);
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
                if (!qnode) {
                        break;  /* Queue is empty. */
                }
                /* Getting the container structure from the node */
                node = caa_container_of(qnode, struct mynode, node);
                printf(" %d", node->value);
-               call_rcu(&node->rcu_head, free_node);
+               urcu_memb_call_rcu(&node->rcu_head, free_node);
        }
        printf("\n");
        /*
@@ -110,6 +110,6 @@ int main(int argc, char **argv)
                printf("Error destroying queue (non-empty)\n");
        }
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index a8c6f8653814d4d9e7ab7b785599586ffe9d7373..1e78f1694295280fb5c7891e9c52f92e8bd40669 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <urcu.h>              /* RCU flavor */
+#include <urcu/urcu-memb.h>    /* RCU flavor */
 #include <urcu/rculfqueue.h>   /* RCU Lock-free queue */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -40,9 +40,9 @@ 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();
 
-       cds_lfq_init_rcu(&myqueue, call_rcu);
+       cds_lfq_init_rcu(&myqueue, urcu_memb_call_rcu);
 
        /*
         * Enqueue nodes.
@@ -62,12 +62,12 @@ int main(int argc, char **argv)
                 * Both enqueue and dequeue need to be called within RCU
                 * read-side critical section.
                 */
-               rcu_read_lock();
+               urcu_memb_read_lock();
                cds_lfq_enqueue_rcu(&myqueue, &node->node);
-               rcu_read_unlock();
+               urcu_memb_read_unlock();
        }
 
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index 64978fcef2f8f305e3c4f72078f99b415d98fc25..1875a860b781a9f91ff80beb25d302f6a6dd44fb 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <urcu-bp.h>           /* Bulletproof RCU flavor */
+#include <urcu/urcu-bp.h>      /* Bulletproof RCU flavor */
 #include <urcu/rculist.h>      /* List example */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
         * with rcu_read_lock() and rcu_read_unlock(). They can be
         * nested. Those are no-ops for the QSBR flavor.
         */
-       rcu_read_lock();
+       urcu_bp_read_lock();
 
        /*
         * RCU traversal of the linked list.
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
        cds_list_for_each_entry_rcu(node, &mylist, node) {
                printf("Value: %" PRIu64 "\n", node->value);
        }
-       rcu_read_unlock();
+       urcu_bp_read_unlock();
 
        /*
         * Removing nodes from linked list. Safe against concurrent RCU
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
                 * spawning any call_rcu() thread. It is slower though,
                 * since there is no batching.
                 */
-               synchronize_rcu();
+               urcu_bp_synchronize_rcu();
                free(node);
        }
 
index 62ad54bb7ff00309f7de7572116de1222bd8b7ee..e103e4f91f55f1d69078733136366d05145194a7 100644 (file)
@@ -22,8 +22,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#define RCU_MB                 /* Memory barrier RCU flavor */
-#include <urcu.h>
+#include <urcu/urcu-mb.h>      /* Memory barrier RCU flavor */
 #include <urcu/rculist.h>      /* List example */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -75,7 +74,7 @@ int main(int argc, char **argv)
         * Each thread need using RCU read-side need to be explicitly
         * registered.
         */
-       rcu_register_thread();
+       urcu_mb_register_thread();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -92,7 +91,7 @@ int main(int argc, char **argv)
         * with rcu_read_lock() and rcu_read_unlock(). They can be
         * nested. Those are no-ops for the QSBR flavor.
         */
-       rcu_read_lock();
+       urcu_mb_read_lock();
 
        /*
         * RCU traversal of the linked list.
@@ -100,7 +99,7 @@ int main(int argc, char **argv)
        cds_list_for_each_entry_rcu(node, &mylist, node) {
                printf("Value: %" PRIu64 "\n", node->value);
        }
-       rcu_read_unlock();
+       urcu_mb_read_unlock();
 
        /*
         * Removing nodes from linked list. Safe against concurrent RCU
@@ -114,7 +113,7 @@ int main(int argc, char **argv)
                 * call_rcu() can be called from RCU read-side critical
                 * sections.
                 */
-               call_rcu(&node->rcu_head, rcu_free_node);
+               urcu_mb_call_rcu(&node->rcu_head, rcu_free_node);
        }
 
        /*
@@ -124,7 +123,7 @@ int main(int argc, char **argv)
         * batch work. Moreover, call_rcu() can be called from a RCU
         * read-side critical section, but synchronize_rcu() should not.
         */
-       synchronize_rcu();
+       urcu_mb_synchronize_rcu();
 
        sleep(1);
 
@@ -133,9 +132,9 @@ int main(int argc, char **argv)
         * before program exits, or in library destructors, is a good
         * practice.
         */
-       rcu_barrier();
+       urcu_mb_barrier();
 
 end:
-       rcu_unregister_thread();
+       urcu_mb_unregister_thread();
        return ret;
 }
index 21f4579972193497366eacb8d137c001bce1c3f4..f9523d5d16dbea16021f86a4b92e170abc71ad52 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <urcu.h>              /* Default: sys_membarrier() RCU flavor */
+#include <urcu/urcu-memb.h>    /* sys_membarrier() RCU flavor */
 #include <urcu/rculist.h>      /* List example */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -74,7 +74,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();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
         * with rcu_read_lock() and rcu_read_unlock(). They can be
         * nested. Those are no-ops for the QSBR flavor.
         */
-       rcu_read_lock();
+       urcu_memb_read_lock();
 
        /*
         * RCU traversal of the linked list.
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
        cds_list_for_each_entry_rcu(node, &mylist, node) {
                printf("Value: %" PRIu64 "\n", node->value);
        }
-       rcu_read_unlock();
+       urcu_memb_read_unlock();
 
        /*
         * Removing nodes from linked list. Safe against concurrent RCU
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
                 * call_rcu() can be called from RCU read-side critical
                 * sections.
                 */
-               call_rcu(&node->rcu_head, rcu_free_node);
+               urcu_memb_call_rcu(&node->rcu_head, rcu_free_node);
        }
 
        /*
@@ -123,7 +123,7 @@ int main(int argc, char **argv)
         * batch work. Moreover, call_rcu() can be called from a RCU
         * read-side critical section, but synchronize_rcu() should not.
         */
-       synchronize_rcu();
+       urcu_memb_synchronize_rcu();
 
        sleep(1);
 
@@ -132,9 +132,9 @@ int main(int argc, char **argv)
         * before program exits, or in library destructors, is a good
         * practice.
         */
-       rcu_barrier();
+       urcu_memb_barrier();
 
 end:
-       rcu_unregister_thread();
+       urcu_memb_unregister_thread();
        return ret;
 }
index 1dbd54635cbe06a4ca71bb9a60fdb87bcb8c9dec..7af8ada31fc59543a2573d2cbdfce9bbe83b5004 100644 (file)
@@ -22,7 +22,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#include <urcu-qsbr.h>         /* QSBR RCU flavor */
+#include <urcu/urcu-qsbr.h>    /* QSBR RCU flavor */
 #include <urcu/rculist.h>      /* List example */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
         * Each thread need using RCU read-side need to be explicitly
         * registered.
         */
-       rcu_register_thread();
+       urcu_qsbr_register_thread();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
                 * call_rcu() can be called from RCU read-side critical
                 * sections.
                 */
-               call_rcu(&node->rcu_head, rcu_free_node);
+               urcu_qsbr_call_rcu(&node->rcu_head, rcu_free_node);
        }
 
        /*
@@ -113,18 +113,18 @@ int main(int argc, char **argv)
         * every online registered RCU threads in the program
         * periodically.
         */
-       rcu_quiescent_state();
+       urcu_qsbr_quiescent_state();
 
        /*
         * For QSBR flavor, when a thread needs to be in a quiescent
         * state for a long period of time, we use rcu_thread_offline()
         * and rcu_thread_online().
         */
-       rcu_thread_offline();
+       urcu_qsbr_thread_offline();
 
        sleep(1);
 
-       rcu_thread_online();
+       urcu_qsbr_thread_online();
 
        /*
         * We can also wait for a quiescent state by calling
@@ -134,16 +134,16 @@ int main(int argc, char **argv)
         * read-side critical section, but synchronize_rcu() ensures the
         * caller thread is offline, thus acting as a quiescent state.
         */
-       synchronize_rcu();
+       urcu_qsbr_synchronize_rcu();
 
        /*
         * Waiting for previously called call_rcu handlers to complete
         * before program exits, or in library destructors, is a good
         * practice.
         */
-       rcu_barrier();
+       urcu_qsbr_barrier();
 
 end:
-       rcu_unregister_thread();
+       urcu_qsbr_unregister_thread();
        return ret;
 }
index 136c3801f887e132e6da32df32be9eac4926b5e7..e396b9efacbf1700a7302e78f6d5ae89b305ce43 100644 (file)
@@ -22,8 +22,7 @@
 #include <stdint.h>
 #include <inttypes.h>
 
-#define RCU_SIGNAL             /* Signal-based RCU flavor */
-#include <urcu.h>
+#include <urcu/urcu-signal.h>  /* Signal-based RCU flavor */
 #include <urcu/rculist.h>      /* List example */
 #include <urcu/compiler.h>     /* For CAA_ARRAY_SIZE */
 
@@ -74,7 +73,7 @@ int main(int argc, char **argv)
         * Each thread need using RCU read-side need to be explicitly
         * registered.
         */
-       rcu_register_thread();
+       urcu_signal_register_thread();
 
        /*
         * Adding nodes to the linked-list. Safe against concurrent
@@ -91,7 +90,7 @@ int main(int argc, char **argv)
         * with rcu_read_lock() and rcu_read_unlock(). They can be
         * nested. Those are no-ops for the QSBR flavor.
         */
-       rcu_read_lock();
+       urcu_signal_read_lock();
 
        /*
         * RCU traversal of the linked list.
@@ -99,7 +98,7 @@ int main(int argc, char **argv)
        cds_list_for_each_entry_rcu(node, &mylist, node) {
                printf("Value: %" PRIu64 "\n", node->value);
        }
-       rcu_read_unlock();
+       urcu_signal_read_unlock();
 
        /*
         * Removing nodes from linked list. Safe against concurrent RCU
@@ -113,7 +112,7 @@ int main(int argc, char **argv)
                 * call_rcu() can be called from RCU read-side critical
                 * sections.
                 */
-               call_rcu(&node->rcu_head, rcu_free_node);
+               urcu_signal_call_rcu(&node->rcu_head, rcu_free_node);
        }
 
        /*
@@ -123,7 +122,7 @@ int main(int argc, char **argv)
         * batch work. Moreover, call_rcu() can be called from a RCU
         * read-side critical section, but synchronize_rcu() should not.
         */
-       synchronize_rcu();
+       urcu_signal_synchronize_rcu();
 
        sleep(1);
 
@@ -132,9 +131,9 @@ int main(int argc, char **argv)
         * before program exits, or in library destructors, is a good
         * practice.
         */
-       rcu_barrier();
+       urcu_signal_barrier();
 
 end:
-       rcu_unregister_thread();
+       urcu_signal_unregister_thread();
        return ret;
 }
This page took 0.054265 seconds and 4 git commands to generate.