{
        int pgoff;
 
+       rcu_register_thread();
+
        while (!test_complete) {
                for (pgoff = 0; pgoff < 100; pgoff++) {
                        pthread_mutex_lock(&tree_lock);
                }
        }
 
+       rcu_unregister_thread();
+
        return NULL;
 }
 
        struct radix_tree_iter iter;
        void **slot;
 
+       rcu_register_thread();
+
        while (!test_complete) {
                rcu_read_lock();
                radix_tree_for_each_tagged(slot, &tree, &iter, 0, TAG) {
                                continue;
                        }
 
-                       if (rand_r(&seeds[0]) % 50 == 0)
+                       if (rand_r(&seeds[0]) % 50 == 0) {
                                slot = radix_tree_iter_next(&iter);
+                               rcu_read_unlock();
+                               rcu_barrier();
+                               rcu_read_lock();
+                       }
                }
                rcu_read_unlock();
        }
 
+       rcu_unregister_thread();
+
        return NULL;
 }
 
        struct radix_tree_iter iter;
        void **slot;
 
+       rcu_register_thread();
+
        while (!test_complete) {
                rcu_read_lock();
                radix_tree_for_each_slot(slot, &tree, &iter, 0) {
                                continue;
                        }
 
-                       if (rand_r(&seeds[1]) % 50 == 0)
+                       if (rand_r(&seeds[1]) % 50 == 0) {
                                slot = radix_tree_iter_next(&iter);
+                               rcu_read_unlock();
+                               rcu_barrier();
+                               rcu_read_lock();
+                       }
                }
                rcu_read_unlock();
        }
 
+       rcu_unregister_thread();
+
        return NULL;
 }
 
  */
 static void *remove_entries_fn(void *arg)
 {
+       rcu_register_thread();
+
        while (!test_complete) {
                int pgoff;
 
                pthread_mutex_unlock(&tree_lock);
        }
 
+       rcu_unregister_thread();
+
        return NULL;
 }