Expand description
§Thread Safety Primitives
Based on “Formal methods for the unsafe side of the Force” (Antithesis, 2026). Provides rigorously defined primitives for bridging FFI and multi-threaded boundaries.
§RelaxedAtomic<T>
Provides inner mutability for Copy types via relaxed atomic loads and stores.
On x86_64 and ARM, relaxed loads/stores compile to the same instructions as
regular memory accesses (no LOCK prefix), making this a zero-overhead way to
achieve interior mutability for atomic-compatible types.
Deliberately omits fetch_* / CAS methods — those lower to bus-lock instructions
that add noticeable overhead. Instead, use the load–mutate–store pattern:
let counter = RelaxedAtomic::new(0u32);
let val = counter.load();
counter.store(val + 1);Structs§
- Main
Thread Token - A witness of execution that exists solely on a designated “Main Thread”.
- Relaxed
Atomic - Provides inner mutability for
Copytypes via relaxed atomic operations. - Send
Wrapper - A wrapper that allows sending non-
Sendtypes across thread boundaries.
Traits§
- Atomic
Repr - Trait for types that can be stored in a
RelaxedAtomic.
Functions§
- designate_
main_ thread - Designate the calling thread as the application’s main thread.
- main_
thread_ id - Returns the
ThreadIdpreviously designated as the main thread, if any.