pub struct LockFreeUtils;
Expand description
Lock-free atomic utilities for high-performance operations.
Implementations§
Source§impl LockFreeUtils
impl LockFreeUtils
Sourcepub fn atomic_update<F>(atomic: &AtomicU64, updater: F) -> u64
pub fn atomic_update<F>(atomic: &AtomicU64, updater: F) -> u64
Perform an atomic read-modify-write operation with retry.
Sourcepub fn atomic_increment_bounded(
atomic: &AtomicU64,
max_value: u64,
) -> Result<u64, u64>
pub fn atomic_increment_bounded( atomic: &AtomicU64, max_value: u64, ) -> Result<u64, u64>
Perform an atomic increment with overflow protection.
Sourcepub fn atomic_decrement_bounded(
atomic: &AtomicU64,
min_value: u64,
) -> Result<u64, u64>
pub fn atomic_decrement_bounded( atomic: &AtomicU64, min_value: u64, ) -> Result<u64, u64>
Perform an atomic decrement with underflow protection.
Sourcepub fn double_checked_init<T, F>(
atomic_flag: &AtomicUsize,
initializer: F,
) -> boolwhere
F: FnOnce() -> T,
pub fn double_checked_init<T, F>(
atomic_flag: &AtomicUsize,
initializer: F,
) -> boolwhere
F: FnOnce() -> T,
Double-checked locking pattern helper.
Auto Trait Implementations§
impl Freeze for LockFreeUtils
impl RefUnwindSafe for LockFreeUtils
impl Send for LockFreeUtils
impl Sync for LockFreeUtils
impl Unpin for LockFreeUtils
impl UnwindSafe for LockFreeUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more