Struct core::atomics::AtomicPtr[src]

pub struct AtomicPtr<T> {
    // some fields omitted
}

An unsafe atomic pointer. Only supports basic atomic operations

Methods

impl<T> AtomicPtr<T>

fn new(p: *mut T) -> AtomicPtr<T>

Create a new AtomicPtr

fn load(&self, order: Ordering) -> *mut T

Load the value

fn store(&self, ptr: *mut T, order: Ordering)

Store the value

fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T

Store a value, returning the old value

fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T

If the current value is the same as expected, store a new value

Compare the current value with old; if they are the same then replace the current value with new. Return the previous value. If the return value is equal to old then the value was updated.