crossbeam_utils::atomic

Trait AtomicConsume

Source
pub trait AtomicConsume {
    type Val;

    // Required method
    fn load_consume(&self) -> Self::Val;
}
Expand description

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

Required Associated Types§

Source

type Val

Type returned by load_consume.

Required Methods§

Source

fn load_consume(&self) -> Self::Val

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§

Source§

impl AtomicConsume for AtomicBool

Source§

type Val = bool

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicI8

Source§

type Val = i8

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicI16

Source§

type Val = i16

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicI32

Source§

type Val = i32

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicI64

Source§

type Val = i64

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicIsize

Source§

type Val = isize

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicU8

Source§

type Val = u8

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicU16

Source§

type Val = u16

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicU32

Source§

type Val = u32

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicU64

Source§

type Val = u64

Source§

fn load_consume(&self) -> Self::Val

Source§

impl AtomicConsume for AtomicUsize

Source§

type Val = usize

Source§

fn load_consume(&self) -> Self::Val

Source§

impl<T> AtomicConsume for AtomicPtr<T>

Source§

type Val = *mut T

Source§

fn load_consume(&self) -> Self::Val

Implementors§