aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-14 08:04:11 +0100
committerAleksey Kladov <[email protected]>2020-07-14 08:04:11 +0100
commitc6f35401219e32c7d62e106a45637e7f5304723c (patch)
treed1626f115ca07b35238968a836173a0711be6ecb /crates/test_utils/src
parent46d4487b8900324fc6a523c8b6ebe036d28fd0fb (diff)
Use relaxed ordering for marks
We dont' need this for perf. `Relaxed` ordering is enough here, as we only have one location. I prefer to use minimal ordering, because that makes it easier to reason about the code.
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r--crates/test_utils/src/mark.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/test_utils/src/mark.rs b/crates/test_utils/src/mark.rs
index 7c309a894..97f5a93ad 100644
--- a/crates/test_utils/src/mark.rs
+++ b/crates/test_utils/src/mark.rs
@@ -62,7 +62,7 @@ pub struct MarkChecker {
62 62
63impl MarkChecker { 63impl MarkChecker {
64 pub fn new(mark: &'static AtomicUsize) -> MarkChecker { 64 pub fn new(mark: &'static AtomicUsize) -> MarkChecker {
65 let value_on_entry = mark.load(Ordering::SeqCst); 65 let value_on_entry = mark.load(Ordering::Relaxed);
66 MarkChecker { mark, value_on_entry } 66 MarkChecker { mark, value_on_entry }
67 } 67 }
68} 68}
@@ -72,7 +72,7 @@ impl Drop for MarkChecker {
72 if std::thread::panicking() { 72 if std::thread::panicking() {
73 return; 73 return;
74 } 74 }
75 let value_on_exit = self.mark.load(Ordering::SeqCst); 75 let value_on_exit = self.mark.load(Ordering::Relaxed);
76 assert!(value_on_exit > self.value_on_entry, "mark was not hit") 76 assert!(value_on_exit > self.value_on_entry, "mark was not hit")
77 } 77 }
78} 78}