#[cfg(loom)]
#[allow(unused_imports)]
pub(crate) use loom::{
cell::UnsafeCell,
sync::atomic::{AtomicIsize, AtomicPtr, AtomicU32, AtomicUsize, Ordering, fence},
sync::{Arc, Condvar, Mutex, MutexGuard},
thread,
};
#[cfg(loom)]
pub(crate) use loom::thread_local;
#[cfg(not(loom))]
pub(crate) use std::thread_local;
#[cfg(not(loom))]
#[allow(unused_imports)]
pub(crate) use std::{
sync::atomic::{AtomicIsize, AtomicPtr, AtomicU32, AtomicUsize, Ordering, fence},
sync::{Arc, Condvar, Mutex, MutexGuard},
thread,
};
#[cfg(not(loom))]
#[derive(Debug)]
#[repr(transparent)]
pub(crate) struct UnsafeCell<T>(std::cell::UnsafeCell<T>);
#[cfg(not(loom))]
impl<T> UnsafeCell<T> {
#[inline]
pub(crate) const fn new(value: T) -> Self {
Self(std::cell::UnsafeCell::new(value))
}
#[inline]
pub(crate) fn with_mut<R>(&self, f: impl FnOnce(*mut T) -> R) -> R {
f(self.0.get())
}
}