1#[cfg(not(all(test, loom)))]
2pub(crate) mod sync {
3 pub(crate) mod atomic {
4 pub(crate) use core::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
5
6 pub(crate) trait AtomicMut<T> {
7 fn with_mut<F, R>(&mut self, f: F) -> R
8 where
9 F: FnOnce(&mut *mut T) -> R;
10 }
11
12 impl<T> AtomicMut<T> for AtomicPtr<T> {
13 fn with_mut<F, R>(&mut self, f: F) -> R
14 where
15 F: FnOnce(&mut *mut T) -> R,
16 {
17 f(self.get_mut())
18 }
19 }
20 }
21}
22
23#[cfg(all(test, loom))]
24pub(crate) mod sync {
25 pub(crate) mod atomic {
26 pub(crate) use loom::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
27
28 pub(crate) trait AtomicMut<T> {}
29 }
30}
31