X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Ftest_ht.c;h=cdc78d54c420f0b9f4128aadd429c2dd5266a261;hb=44395fb70714eea662bb1b76a82f704ffd874222;hp=26361454997e98b6cd352410853909f36befffc1;hpb=af3dc81941a7a076fabada6b7575e4293595660b;p=urcu.git 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()))