rculfhash: update add_unique api
[urcu.git] / tests / test_urcu_hash.c
index e8c51d86acaa4043391b91f1262755c654d28682..16374d93ee5903876b03da344df97e302769959c 100644 (file)
@@ -387,7 +387,7 @@ void free_node_cb(struct rcu_head *head)
 
 void *thr_writer(void *_count)
 {
-       struct rcu_ht_node *node;
+       struct rcu_ht_node *node, *ret_node;
        struct wr_count *count = _count;
        int ret;
 
@@ -410,9 +410,9 @@ void *thr_writer(void *_count)
                        ht_node_init(node,
                                (void *)(unsigned long)(rand_r(&rand_lookup) % RAND_POOL),
                                sizeof(void *));
-                       ret = ht_add_unique(test_ht, node);
+                       ret_node = ht_add_unique(test_ht, node);
                        rcu_read_unlock();
-                       if (ret) {
+                       if (ret_node != node) {
                                free(node);
                                nr_addexist++;
                        } else
@@ -569,6 +569,7 @@ int main(int argc, char **argv)
        count_writer = malloc(sizeof(*count_writer) * nr_writers);
        test_ht = ht_new(test_hash, test_compare, 0x42UL,
                         HASH_SIZE, call_rcu);
+
        next_aff = 0;
 
        for (i = 0; i < nr_readers; i++) {
This page took 0.0226 seconds and 4 git commands to generate.