- static void run_rcu_sync(size_t pass_count, unsigned write_percentage) {
- for (size_t count = 0; count < pass_count; count++) {
- if (rand(100) < write_percentage) {
- auto *old_data = rcu_data.load(std::memory_order_relaxed);
- auto *new_data = new RcuData();
- rcu_data.store(new_data, std::memory_order_relaxed);
- folly::rcu_retire(old_data);
- } else {
- folly::rcu_reader g;
- }
- }
- }
-
- // writer_freq is the milliseconds a writer should wait before another writer
- // happens.
- static void run_rcu_writer_sync(size_t pass_count, unsigned writer_freq) {
- for (size_t count = 0; count < pass_count; count++) {