about summary refs log tree commit diff
path: root/library/core/src/sync/atomic.rs
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-05-13 20:59:21 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-05-13 21:22:54 +0200
commitd11667f5ccf148270362fb9a5cf39ed06eff7374 (patch)
treef7dcfc4291a4a0db0065fe622d5f4a713343589b /library/core/src/sync/atomic.rs
parenta7d6408b05912396618dfdcc9cc713d3ace2aa9a (diff)
downloadrust-d11667f5ccf148270362fb9a5cf39ed06eff7374.tar.gz
rust-d11667f5ccf148270362fb9a5cf39ed06eff7374.zip
Change orderings of `Debug` for the Atomic types to `Relaxed`.
This reduces synchronization between threads when
debugging the atomic types.
Reducing the synchronization means that executions with and
without the debug calls will be more consistent,
making it easier to debug.
Diffstat (limited to 'library/core/src/sync/atomic.rs')
-rw-r--r--library/core/src/sync/atomic.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index a01f3fbad56..c0aa5dd4cc3 100644
--- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs
@@ -1517,7 +1517,7 @@ macro_rules! atomic_int {
         #[$stable_debug]
         impl fmt::Debug for $atomic_type {
             fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-                fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
+                fmt::Debug::fmt(&self.load(Ordering::Relaxed), f)
             }
         }
 
@@ -2996,7 +2996,7 @@ pub fn compiler_fence(order: Ordering) {
 #[stable(feature = "atomic_debug", since = "1.3.0")]
 impl fmt::Debug for AtomicBool {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
+        fmt::Debug::fmt(&self.load(Ordering::Relaxed), f)
     }
 }
 
@@ -3004,7 +3004,7 @@ impl fmt::Debug for AtomicBool {
 #[stable(feature = "atomic_debug", since = "1.3.0")]
 impl<T> fmt::Debug for AtomicPtr<T> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Debug::fmt(&self.load(Ordering::SeqCst), f)
+        fmt::Debug::fmt(&self.load(Ordering::Relaxed), f)
     }
 }