pub enum MemOrder {
NotAtomic,
Relaxed,
Acquire,
Release,
AcqRel,
SeqCst,
}Expand description
How strongly an atomic operation is ordered against everything around it.
These are C11’s, minus consume, which every compiler in existence widens to acquire
because nobody can implement it as specified and the standard committee has said so.
Variants§
NotAtomic
Not atomic at all, which is what an ordinary load or store is.
Relaxed
Atomic, with no ordering against anything else.
Acquire
Nothing after this in program order moves before it.
Release
Nothing before this in program order moves after it.
AcqRel
Both, for a read-modify-write.
SeqCst
Both, and a single total order over every sequentially consistent operation.
Implementations§
Source§impl MemOrder
impl MemOrder
Sourcepub const fn is_valid_for_load(self) -> bool
pub const fn is_valid_for_load(self) -> bool
Whether this ordering can be asked of a load.
A load cannot release, because there is nothing it published.
Sourcepub const fn is_valid_for_store(self) -> bool
pub const fn is_valid_for_store(self) -> bool
Whether this ordering can be asked of a store.
A store cannot acquire, because it read nothing to synchronise with.
Sourcepub const fn is_valid_for_rmw(self) -> bool
pub const fn is_valid_for_rmw(self) -> bool
Whether this ordering can be asked of a read-modify-write, which is any of them.