about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/sync.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-03-15 16:25:28 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-04-04 09:01:44 +0000
commit54214c8d8d50c76fa66e1411fbbbd17bf314bcb5 (patch)
tree7bfbedf8fd640a37b2ca4a5c2b6d3221b57acf87 /compiler/rustc_data_structures/src/sync.rs
parent300901b70509a0af2d971aa6f6104300da24212c (diff)
downloadrust-54214c8d8d50c76fa66e1411fbbbd17bf314bcb5.tar.gz
rust-54214c8d8d50c76fa66e1411fbbbd17bf314bcb5.zip
Use a simpler atomic operation than the `compare_exchange` hammer
Diffstat (limited to 'compiler/rustc_data_structures/src/sync.rs')
-rw-r--r--compiler/rustc_data_structures/src/sync.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs
index 80a9ccd6daa..e8ee4fb76cc 100644
--- a/compiler/rustc_data_structures/src/sync.rs
+++ b/compiler/rustc_data_structures/src/sync.rs
@@ -107,6 +107,14 @@ cfg_if! {
             }
         }
 
+        impl Atomic<bool> {
+            pub fn fetch_or(&self, val: bool, _: Ordering) -> bool {
+                let result = self.0.get() | val;
+                self.0.set(val);
+                result
+            }
+        }
+
         impl<T: Copy + PartialEq> Atomic<T> {
             #[inline]
             pub fn compare_exchange(&self,