Something went wrong. Try again.
🦀🔐 Statically prevent deadlocks crates.io/crates/surelock
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051//! Re-exports atomic types, using `portable-atomic` when the feature//! is enabled. This centralizes the `cfg` logic so individual modules//! don't need to repeat it.//!//! On targets without native CAS (e.g., thumbv6m), enable the//! `portable-atomic` feature.
#[cfg(feature = "portable-atomic")]pub(crate) use portable_atomic::Ordering;
#[cfg(not(feature = "portable-atomic"))]pub(crate) use core::sync::atomic::Ordering;
// -- AtomicBool --
#[cfg(feature = "portable-atomic")]pub(crate) use portable_atomic::AtomicBool;
#[cfg(not(feature = "portable-atomic"))]pub(crate) use core::sync::atomic::AtomicBool;
// -- AtomicUsize --
#[cfg(feature = "portable-atomic")]pub(crate) use portable_atomic::AtomicUsize;
#[cfg(not(feature = "portable-atomic"))]pub(crate) use core::sync::atomic::AtomicUsize;
// -- LockId atomic + inner type --
#[cfg(all(feature = "atomic-u64", feature = "portable-atomic"))]pub(crate) type AtomicId = portable_atomic::AtomicU64;#[cfg(all(feature = "atomic-u64", feature = "portable-atomic"))]pub(crate) type IdInner = u64;
#[cfg(all(feature = "atomic-u64", not(feature = "portable-atomic")))]pub(crate) type AtomicId = core::sync::atomic::AtomicU64;#[cfg(all(feature = "atomic-u64", not(feature = "portable-atomic")))]pub(crate) type IdInner = u64;
#[cfg(all(not(feature = "atomic-u64"), feature = "portable-atomic"))]pub(crate) type AtomicId = portable_atomic::AtomicU32;#[cfg(all(not(feature = "atomic-u64"), feature = "portable-atomic"))]pub(crate) type IdInner = u32;
#[cfg(not(any(feature = "atomic-u64", feature = "portable-atomic")))]pub(crate) type AtomicId = core::sync::atomic::AtomicU32;#[cfg(not(any(feature = "atomic-u64", feature = "portable-atomic")))]pub(crate) type IdInner = u32;