Trait crossbeam_utils::atomic::AtomicConsume[][src]

pub trait AtomicConsume {
    type Val;
    fn load_consume(&self) -> Self::Val;
}
Expand description

Trait which allows reading from primitive atomic types with “consume” ordering.

Associated Types

type Val[src]

Type returned by load_consume.

Required methods

fn load_consume(&self) -> Self::Val[src]

Loads a value from the atomic using a “consume” memory ordering.

This is similar to the “acquire” ordering, except that an ordering is only guaranteed with operations that “depend on” the result of the load. However consume loads are usually much faster than acquire loads on architectures with a weak memory model since they don’t require memory fence instructions.

The exact definition of “depend on” is a bit vague, but it works as you would expect in practice since a lot of software, especially the Linux kernel, rely on this behavior.

This is currently only implemented on ARM and AArch64, where a fence can be avoided. On other architectures this will fall back to a simple load(Ordering::Acquire).

Implementations on Foreign Types

impl AtomicConsume for AtomicBool[src]

type Val = bool

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicUsize[src]

type Val = usize

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicIsize[src]

type Val = isize

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicU8[src]

type Val = u8

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicI8[src]

type Val = i8

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicU16[src]

type Val = u16

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicI16[src]

type Val = i16

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicU32[src]

type Val = u32

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicI32[src]

type Val = i32

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicU64[src]

type Val = u64

fn load_consume(&self) -> Self::Val[src]

impl AtomicConsume for AtomicI64[src]

type Val = i64

fn load_consume(&self) -> Self::Val[src]

impl<T> AtomicConsume for AtomicPtr<T>[src]

type Val = *mut T

fn load_consume(&self) -> Self::Val[src]

Implementors