mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
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:
parent
46d4487b89
commit
c6f3540121
1 changed files with 2 additions and 2 deletions
|
@ -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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue