Trait syncbox::atomic::Atomic
[−]
[src]
pub trait Atomic<T>: Send + Sync { fn new(val: T) -> Self; fn load(&self, order: Ordering) -> T; fn store(&self, val: T, order: Ordering); fn swap(&self, val: T, order: Ordering) -> T; fn compare_and_swap(&self, old: T, new: T, order: Ordering) -> T; }
An atomic box
Required Methods
fn new(val: T) -> Self
Returns a new atomic box
fn load(&self, order: Ordering) -> T
Atomically loads the value from the box with the given ordering
fn store(&self, val: T, order: Ordering)
Atomically stores the value from the box with the given ordering
fn swap(&self, val: T, order: Ordering) -> T
Atomically swaps the value in the box with the given ordering
fn compare_and_swap(&self, old: T, new: T, order: Ordering) -> T
Swaps the value in the box if and only if the existing value is equal
to old
.
Implementors
impl<T: ToAtomicRepr, A: Atomic<T::Repr>> Atomic<T> for AtomicVal<T, A>
impl Atomic<usize> for AtomicUsize