pub struct AtomicPtr<T> { /* private fields */ }Expand description
A managed atomic pointer type for use with hazard pointer domains.
Wraps AtomicPtr and returns Replaced<T> from mutation operations,
ensuring displaced pointers are properly retired.
Implementations§
Source§impl<T> AtomicPtr<T>
impl<T> AtomicPtr<T>
Sourcepub fn swap(&self, new: *mut T, order: Ordering) -> Replaced<T>
pub fn swap(&self, new: *mut T, order: Ordering) -> Replaced<T>
Atomically swaps the pointer, returning the old value as a Replaced<T>
that must be retired.
Sourcepub fn compare_exchange(
&self,
current: *mut T,
new: *mut T,
success: Ordering,
failure: Ordering,
) -> Result<Replaced<T>, *mut T>
pub fn compare_exchange( &self, current: *mut T, new: *mut T, success: Ordering, failure: Ordering, ) -> Result<Replaced<T>, *mut T>
Atomically compares and exchanges the pointer. On success, returns
Ok(Replaced<T>) containing the old value that must be retired.
On failure, returns Err(*mut T) with the current value.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for AtomicPtr<T>
impl<T> RefUnwindSafe for AtomicPtr<T>
impl<T> Send for AtomicPtr<T>
impl<T> Sync for AtomicPtr<T>
impl<T> Unpin for AtomicPtr<T>
impl<T> UnsafeUnpin for AtomicPtr<T>
impl<T> UnwindSafe for AtomicPtr<T>where
T: RefUnwindSafe,
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