diff --git a/src/lib.rs b/src/lib.rs index f2c1a14..35411e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ // Behind the feature gates -#![cfg_attr(feature = "hw", feature(stdsimd))] +#![cfg_attr(feature = "hw", feature(portable_simd))] #![cfg_attr(feature = "hw", feature(llvm_asm))] +#![cfg_attr(feature = "hw", feature(stdarch_x86_rtm))] // FIXME: Baking still #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/sync/atomics.rs b/src/sync/atomics.rs index c389308..d9b6ccb 100644 --- a/src/sync/atomics.rs +++ b/src/sync/atomics.rs @@ -107,6 +107,13 @@ impl AtomicBox { let ptr = Arc::into_raw(Arc::new(new_val)) as *mut T; self.release(ptr); } + + /// + /// Atomically replace the inner value with the given one. + pub fn replace(&self, new_val: T) { + let ptr = Arc::into_raw(Arc::new(new_val)) as *mut T; + self.release(ptr); + } } impl PartialEq for AtomicBox {