X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_ht.c;h=cdc78d54c420f0b9f4128aadd429c2dd5266a261;hp=26361454997e98b6cd352410853909f36befffc1;hb=c4aed19a0ef9f02e474cee682bd261dfaa56a495;hpb=5e28c5328529ace4f43b70139acf7ef9b0329c4a diff --git a/tests/test_ht.c b/tests/test_ht.c index 2636145..cdc78d5 100644 --- a/tests/test_ht.c +++ b/tests/test_ht.c @@ -249,6 +249,7 @@ void *thr_writer(void *_count) for (;;) { if (rand_r(&rand_lookup) & 1) { data = malloc(sizeof(struct test_data)); + //rcu_copy_mutex_lock(); ret = ht_add(test_ht, (void *)(unsigned long)(rand_r(&rand_lookup) % RAND_POOL), data); @@ -258,14 +259,25 @@ void *thr_writer(void *_count) } else { nr_add++; } + //rcu_copy_mutex_unlock(); } else { /* May delete */ + //rcu_copy_mutex_lock(); ret = ht_delete(test_ht, (void *)(unsigned long)(rand_r(&rand_lookup) % RAND_POOL)); if (ret == -ENOENT) nr_delnoent++; else nr_del++; + //rcu_copy_mutex_unlock(); + } + //if (nr_writes % 100000 == 0) { + if (nr_writes % 1000 == 0) { + if (rand_r(&rand_lookup) & 1) { + ht_resize(test_ht, 1); + } else { + ht_resize(test_ht, -1); + } } nr_writes++; if (unlikely(!test_duration_write()))