Skip to main content

Module atomic

Module atomic 

Source
Expand description

Atomic shim: loom::sync::atomic under permutation testing, otherwise core::sync::atomic — or, on a target with no native RMW atomics (see the atomics-polyfill feature), portable_atomic instead (plan.md §1.3).

The lock-free core (waker, sync/semaphore, sync/channel, preempt/tcb) is written against this module. Under normal builds (--cfg loom absent, atomics-polyfill off) this is a zero-cost alias of the core atomics; with RUSTFLAGS='--cfg loom' the same code compiles against loom’s atomics, letting the models in tests/loom.rs explore every interleaving of the Acquire/Release orderings that are otherwise justified only by prose comments. With atomics-polyfill on (ARMv6-M boards — no LDREX/STREX, so core’s AtomicU32 etc. don’t even have compare_exchange/fetch_or/swap on that target), portable_atomic provides the identical API via a critical-section- guarded fallback — every call site elsewhere in this crate is unaffected either way.

Structs§

AtomicExperimental
A memory location which can be safely modified from multiple threads.

Enums§

Ordering
Atomic memory orderings

Constants§

ATOMIC_BOOL_INITDeprecated
An AtomicBool initialized to false.
ATOMIC_ISIZE_INITDeprecated
An AtomicIsize initialized to 0.
ATOMIC_USIZE_INITDeprecated
An AtomicUsize initialized to 0.

Traits§

AtomicPrimitiveExperimental
A marker trait for primitive types which can be modified atomically.

Functions§

compiler_fence
An atomic fence for synchronization within a single thread.
fence
An atomic fence.
spin_loop_hintDeprecated
Signals the processor that it is inside a busy-wait spin-loop (“spin lock”).

Type Aliases§

AtomicBool
A boolean type which can be safely shared between threads.
AtomicI8
An integer type which can be safely shared between threads.
AtomicI16
An integer type which can be safely shared between threads.
AtomicI32
An integer type which can be safely shared between threads.
AtomicI64
An integer type which can be safely shared between threads.
AtomicIsize
An integer type which can be safely shared between threads.
AtomicPtr
A raw pointer type which can be safely shared between threads.
AtomicU8
An integer type which can be safely shared between threads.
AtomicU16
An integer type which can be safely shared between threads.
AtomicU32
An integer type which can be safely shared between threads.
AtomicU64
An integer type which can be safely shared between threads.
AtomicUsize
An integer type which can be safely shared between threads.