aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-14 08:05:43 +0100
committerGitHub <[email protected]>2020-07-14 08:05:43 +0100
commita34f79b17412f83242283fae6e7a6275b4056611 (patch)
treed1626f115ca07b35238968a836173a0711be6ecb
parent46d4487b8900324fc6a523c8b6ebe036d28fd0fb (diff)
parentc6f35401219e32c7d62e106a45637e7f5304723c (diff)
Merge #5357
5357: Use relaxed ordering for marks r=matklad a=matklad 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. bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-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}