X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Ftest_urcu_hash.c;h=16374d93ee5903876b03da344df97e302769959c;hb=18117871130163ec2b2fc73fda288b9ba26cd435;hp=b1ff4acb852de2da22c698944a31f5234884ab11;hpb=b8e1907c4dbf59a2b0e627f6b4e942c6a4d13283;p=urcu.git diff --git a/tests/test_urcu_hash.c b/tests/test_urcu_hash.c index b1ff4ac..16374d9 100644 --- a/tests/test_urcu_hash.c +++ b/tests/test_urcu_hash.c @@ -38,7 +38,7 @@ #endif #define HASH_SIZE 32 -#define RAND_POOL 10000 +#define RAND_POOL 1000000 /* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ #define CACHE_LINE_SIZE 4096 @@ -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++) {