From 984b10da169bff9bcc1fcf75984467f0f218108a Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 20 Dec 2021 12:34:10 -0800 Subject: [PATCH] Change Backtrace::enabled atomic from SeqCst to Relaxed --- library/std/src/backtrace.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/std/src/backtrace.rs b/library/std/src/backtrace.rs index 0b86b4f30b9..94e6070c0f7 100644 --- a/library/std/src/backtrace.rs +++ b/library/std/src/backtrace.rs @@ -99,7 +99,7 @@ use crate::env; use crate::ffi::c_void; use crate::fmt; -use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst}; +use crate::sync::atomic::{AtomicUsize, Ordering::Relaxed}; use crate::sync::Once; use crate::sys_common::backtrace::{lock, output_filename}; use crate::vec::Vec; @@ -256,7 +256,7 @@ fn enabled() -> bool { // backtrace captures speedy, because otherwise reading environment // variables every time can be somewhat slow. static ENABLED: AtomicUsize = AtomicUsize::new(0); - match ENABLED.load(SeqCst) { + match ENABLED.load(Relaxed) { 0 => {} 1 => return false, _ => return true, @@ -268,7 +268,7 @@ fn enabled() -> bool { Err(_) => false, }, }; - ENABLED.store(enabled as usize + 1, SeqCst); + ENABLED.store(enabled as usize + 1, Relaxed); enabled }