AtomicExt

Trait AtomicExt 

Source
pub trait AtomicExt<T> {
    // Required methods
    fn compare_exchange_explicit(
        &self,
        current: T,
        new: T,
        success_order: Ordering,
        failure_order: Ordering,
    ) -> Result<T, T>;
    fn fetch_add_explicit(&self, val: T, order: Ordering) -> T;
    fn fetch_sub_explicit(&self, val: T, order: Ordering) -> T;
    fn load_with_barrier(&self, barrier: BarrierType) -> T;
    fn store_with_barrier(&self, val: T, barrier: BarrierType);
}
Expand description

Cross-platform atomic operation extensions.

Required Methods§

Source

fn compare_exchange_explicit( &self, current: T, new: T, success_order: Ordering, failure_order: Ordering, ) -> Result<T, T>

Atomic compare-and-swap with explicit memory ordering.

Source

fn fetch_add_explicit(&self, val: T, order: Ordering) -> T

Atomic fetch-and-add with explicit memory ordering.

Source

fn fetch_sub_explicit(&self, val: T, order: Ordering) -> T

Atomic fetch-and-subtract with explicit memory ordering.

Source

fn load_with_barrier(&self, barrier: BarrierType) -> T

Atomic load with memory barrier.

Source

fn store_with_barrier(&self, val: T, barrier: BarrierType)

Atomic store with memory barrier.

Implementations on Foreign Types§

Source§

impl AtomicExt<u64> for AtomicU64

Source§

fn compare_exchange_explicit( &self, current: u64, new: u64, success_order: Ordering, failure_order: Ordering, ) -> Result<u64, u64>

Source§

fn fetch_add_explicit(&self, val: u64, order: Ordering) -> u64

Source§

fn fetch_sub_explicit(&self, val: u64, order: Ordering) -> u64

Source§

fn load_with_barrier(&self, barrier: BarrierType) -> u64

Source§

fn store_with_barrier(&self, val: u64, barrier: BarrierType)

Source§

impl AtomicExt<usize> for AtomicUsize

Source§

fn compare_exchange_explicit( &self, current: usize, new: usize, success_order: Ordering, failure_order: Ordering, ) -> Result<usize, usize>

Source§

fn fetch_add_explicit(&self, val: usize, order: Ordering) -> usize

Source§

fn fetch_sub_explicit(&self, val: usize, order: Ordering) -> usize

Source§

fn load_with_barrier(&self, barrier: BarrierType) -> usize

Source§

fn store_with_barrier(&self, val: usize, barrier: BarrierType)

Implementors§