- new = test_array_alloc();
- new->a = 8;
- old = rcu_publish_content(&test_rcu_pointer, new);
- if (old)
- old->a = 0;
- test_array_free(old);
+ 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);
+ if (ret == -EEXIST) {
+ free(data);
+ nr_addexist++;
+ } 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);
+ }
+ }