diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-14 08:05:43 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-14 08:05:43 +0100 |
commit | a34f79b17412f83242283fae6e7a6275b4056611 (patch) | |
tree | d1626f115ca07b35238968a836173a0711be6ecb | |
parent | 46d4487b8900324fc6a523c8b6ebe036d28fd0fb (diff) | |
parent | c6f35401219e32c7d62e106a45637e7f5304723c (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.rs | 4 |
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 | ||
63 | impl MarkChecker { | 63 | impl 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 | } |