From 54214c8d8d50c76fa66e1411fbbbd17bf314bcb5 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 15 Mar 2023 16:25:28 +0000 Subject: Use a simpler atomic operation than the `compare_exchange` hammer --- compiler/rustc_data_structures/src/sync.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/rustc_data_structures/src') 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 { + pub fn fetch_or(&self, val: bool, _: Ordering) -> bool { + let result = self.0.get() | val; + self.0.set(val); + result + } + } + impl Atomic { #[inline] pub fn compare_exchange(&self, -- cgit 1.4.1-3-g733a5