X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fstress-test%2Fstress-sequential-folly-sync.cpp;h=5e39e427e67c2de8b66f1be49ff5e1ba9d4abfdb;hp=9622230407976c2653e6dfbad690c6574df0acd2;hb=717229ecf385ee10a91d6c2af859e8550df84531;hpb=a5562cb52be583e617374b7ef66c5560946dc11b diff --git a/folly/stress-test/stress-sequential-folly-sync.cpp b/folly/stress-test/stress-sequential-folly-sync.cpp index 96222304..5e39e427 100644 --- a/folly/stress-test/stress-sequential-folly-sync.cpp +++ b/folly/stress-test/stress-sequential-folly-sync.cpp @@ -44,7 +44,7 @@ protected: size_t sum = 1; for (size_t count = 0; count < pass_count; count++) { folly::rcu_reader g; - auto *data = rcu_data.load(std::memory_order_relaxed); + auto *data = rcu_data.load(std::memory_order_consume); sum += (data->d1 + data->d2); } EXPECT_EQ(sum, 1); @@ -56,16 +56,16 @@ protected: for (size_t count = 0; count < pass_count; count++) { for (int i = 0; i < 100; ++i) { if (i < write_percentage) { - auto* old_data = rcu_data.load(std::memory_order_relaxed); + auto* old_data = rcu_data.load(std::memory_order_consume); auto* new_data = new RcuData(*old_data); new_data->d1++; new_data->d2++; - rcu_data.store(new_data, std::memory_order_relaxed); + rcu_data.store(new_data, std::memory_order_release); folly::synchronize_rcu(); delete old_data; } else { folly::rcu_reader g; - auto* data = rcu_data.load(std::memory_order_relaxed); + auto* data = rcu_data.load(std::memory_order_consume); sum += (data->d1 + data->d2); } } @@ -80,15 +80,15 @@ protected: for (size_t count = 0; count < pass_count; count++) { for (int i = 0; i < 100; ++i) { if (i < write_percentage) { - auto* old_data = rcu_data.load(std::memory_order_relaxed); + auto* old_data = rcu_data.load(std::memory_order_consume); auto* new_data = new RcuData(*old_data); new_data->d1++; new_data->d2++; - rcu_data.store(new_data, std::memory_order_relaxed); + rcu_data.store(new_data, std::memory_order_release); folly::rcu_retire(old_data); } else { folly::rcu_reader g; - auto* data = rcu_data.load(std::memory_order_relaxed); + auto* data = rcu_data.load(std::memory_order_consume); sum += (data->d1 + data->d2); } }