2019-11-13 14:55:25 -08:00
|
|
|
#[cfg(not(all(test, loom)))]
|
2019-10-16 09:53:36 -07:00
|
|
|
pub(crate) mod sync {
|
|
|
|
|
pub(crate) mod atomic {
|
2025-01-31 18:52:54 +09:00
|
|
|
#[cfg(not(feature = "extra-platforms"))]
|
2022-04-15 22:46:40 +02:00
|
|
|
pub(crate) use core::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
2025-01-31 18:52:54 +09:00
|
|
|
#[cfg(feature = "extra-platforms")]
|
|
|
|
|
pub(crate) use extra_platforms::{AtomicPtr, AtomicUsize, Ordering};
|
2020-05-21 19:23:22 -07:00
|
|
|
|
|
|
|
|
pub(crate) trait AtomicMut<T> {
|
|
|
|
|
fn with_mut<F, R>(&mut self, f: F) -> R
|
|
|
|
|
where
|
|
|
|
|
F: FnOnce(&mut *mut T) -> R;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T> AtomicMut<T> for AtomicPtr<T> {
|
|
|
|
|
fn with_mut<F, R>(&mut self, f: F) -> R
|
|
|
|
|
where
|
|
|
|
|
F: FnOnce(&mut *mut T) -> R,
|
|
|
|
|
{
|
|
|
|
|
f(self.get_mut())
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-16 09:53:36 -07:00
|
|
|
}
|
|
|
|
|
}
|
2019-11-13 14:55:25 -08:00
|
|
|
|
|
|
|
|
#[cfg(all(test, loom))]
|
2020-05-21 19:23:22 -07:00
|
|
|
pub(crate) mod sync {
|
|
|
|
|
pub(crate) mod atomic {
|
2022-04-15 22:46:40 +02:00
|
|
|
pub(crate) use loom::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
2020-05-21 19:23:22 -07:00
|
|
|
|
|
|
|
|
pub(crate) trait AtomicMut<T> {}
|
|
|
|
|
}
|
|
|
|
|
}
|