pub enum MemoryOrdering {
Relaxed,
Acquire,
Release,
AcqRel,
SeqCst,
}Expand description
Ordering guarantees an atomic operation carries, relative to other memory operations in the same thread and across threads.
Variants§
Relaxed
No synchronization or ordering constraints.
Acquire
Prevents reordering of subsequent loads.
Release
Prevents reordering of previous stores.
AcqRel
Both acquire and release semantics.
SeqCst
Sequentially consistent: the strongest guarantee.
Implementations§
Source§impl MemoryOrdering
impl MemoryOrdering
Sourcepub fn strength(self) -> u8
pub fn strength(self) -> u8
Where this ordering sits in the total order the C and LLVM memory models put their orderings in, so that one can be compared against another.
Sourcepub fn cmpxchg_failure_rejection(
success: Self,
failure: Self,
) -> Option<&'static str>
pub fn cmpxchg_failure_rejection( success: Self, failure: Self, ) -> Option<&'static str>
Why failure cannot be the failure ordering of a compare-exchange whose
success ordering is success, or None when it can.
A compare-exchange that fails still performs the load and nothing else, so its ordering carries no release, and it may not order more than the success ordering does. C and LLVM both impose these two rules.