projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
doc: update examples to API changes
[urcu.git]
/
doc
/
examples
/
rculfhash
/
cds_lfht_del.c
diff --git
a/doc/examples/rculfhash/cds_lfht_del.c
b/doc/examples/rculfhash/cds_lfht_del.c
index 4bcf15cd7b2d8facc22df5253eedf9e0bce74f1f..efa6d9a705323123a5e68384a253f51f0c1c1c11 100644
(file)
--- a/
doc/examples/rculfhash/cds_lfht_del.c
+++ b/
doc/examples/rculfhash/cds_lfht_del.c
@@
-18,7
+18,7
@@
#include <stdlib.h>
#include <time.h>
#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 */
#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.
*/
* 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);
/* 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.
*/
/*
* 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,
CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING,
- NULL);
+
&urcu_memb_flavor,
NULL);
if (!ht) {
printf("Error allocating hash table\n");
ret = -1;
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.
*/
* 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);
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):");
* 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);
}
cds_lfht_for_each_entry(ht, &iter, node, node) {
printf(" %d", node->value);
}
-
rcu
_read_unlock();
+
urcu_memb
_read_unlock();
printf("\n");
/*
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);
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) {
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);
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)");
}
}
} else {
printf(" (not found)");
}
-
rcu
_read_unlock();
+
urcu_memb
_read_unlock();
}
printf("\n");
printf("hash table content (random order):");
}
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);
}
cds_lfht_for_each_entry(ht, &iter, node, node) {
printf(" %d", node->value);
}
-
rcu
_read_unlock();
+
urcu_memb
_read_unlock();
printf("\n");
end:
printf("\n");
end:
-
rcu
_unregister_thread();
+
urcu_memb
_unregister_thread();
return ret;
}
return ret;
}
This page took
0.024468 seconds
and
4
git commands to generate.