std panicking: ALWAYS_ABORT: use Relaxed memory ordering

As per
  https://github.com/rust-lang/rust/pull/81858#discussion_r626507810

Suggested-by: Mara Bos <m-ou.se@m-ou.se>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2021-05-06 15:11:08 +01:00
parent 1b1bf24636
commit 3cba120ba4

View File

@ -259,7 +259,7 @@ pub mod panic_count {
pub fn increase() -> (bool, usize) {
(
GLOBAL_PANIC_COUNT.fetch_add(1, Ordering::Acquire) & ALWAYS_ABORT_FLAG != 0,
GLOBAL_PANIC_COUNT.fetch_add(1, Ordering::Relaxed) & ALWAYS_ABORT_FLAG != 0,
LOCAL_PANIC_COUNT.with(|c| {
let next = c.get() + 1;
c.set(next);
@ -278,7 +278,7 @@ pub mod panic_count {
}
pub fn set_always_abort() {
GLOBAL_PANIC_COUNT.fetch_or(ALWAYS_ABORT_FLAG, Ordering::Release);
GLOBAL_PANIC_COUNT.fetch_or(ALWAYS_ABORT_FLAG, Ordering::Relaxed);
}
// Disregards ALWAYS_ABORT_FLAG