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.
This commit is contained in:
Aleksey Kladov 2020-07-14 09:04:11 +02:00
parent 46d4487b89
commit c6f3540121

View file

@ -62,7 +62,7 @@ pub struct MarkChecker {
impl MarkChecker { impl MarkChecker {
pub fn new(mark: &'static AtomicUsize) -> MarkChecker { pub fn new(mark: &'static AtomicUsize) -> MarkChecker {
let value_on_entry = mark.load(Ordering::SeqCst); let value_on_entry = mark.load(Ordering::Relaxed);
MarkChecker { mark, value_on_entry } MarkChecker { mark, value_on_entry }
} }
} }
@ -72,7 +72,7 @@ impl Drop for MarkChecker {
if std::thread::panicking() { if std::thread::panicking() {
return; return;
} }
let value_on_exit = self.mark.load(Ordering::SeqCst); let value_on_exit = self.mark.load(Ordering::Relaxed);
assert!(value_on_exit > self.value_on_entry, "mark was not hit") assert!(value_on_exit > self.value_on_entry, "mark was not hit")
} }
} }