#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 */
{
int values[] = { -5, 42, 42, 36, 24, }; /* 42 is duplicated */
struct cds_lfht *ht; /* Hash table */
{
int values[] = { -5, 42, 42, 36, 24, }; /* 42 is duplicated */
struct cds_lfht *ht; /* Hash table */
- ht = cds_lfht_new(1, 1, 0,
+ ht = cds_lfht_new_flavor(1, 1, 0,
ht_node = cds_lfht_add_replace(ht, hash, match, &value,
&node->node);
if (ht_node) {
ht_node = cds_lfht_add_replace(ht, hash, match, &value,
&node->node);
if (ht_node) {
printf("Replaced node (key: %d, seqnum: %d) by (key: %d, seqnum: %d)\n",
ret_node->value, ret_node->seqnum,
node->value, node->seqnum);
printf("Replaced node (key: %d, seqnum: %d) by (key: %d, seqnum: %d)\n",
ret_node->value, ret_node->seqnum,
node->value, node->seqnum);
} else {
printf("Add (key: %d, seqnum: %d)\n",
node->value, node->seqnum);
}
} else {
printf("Add (key: %d, seqnum: %d)\n",
node->value, node->seqnum);
}
cds_lfht_for_each_entry(ht, &iter, node, node) {
printf(" (key: %d, seqnum: %d)",
node->value, node->seqnum);
}
cds_lfht_for_each_entry(ht, &iter, node, node) {
printf(" (key: %d, seqnum: %d)",
node->value, node->seqnum);
}