expression
Sequential consistency and its limits
Sequentially consistent operations participate in a shared total order constrained by the memory model. This does not combine several atomic operations into one transaction or remove the need for a correct algorithm. Expected stdout (not executed): 1 Common mistake: Assuming two separate sequentially consistent operations implement an indivisible concurrent increment.
Formal Syntax & Structure
rust syntaxrust
Ordering::SeqCstWorking Example
Example Snippetrust
fn main() { use std::sync::atomic::{AtomicUsize, Ordering::SeqCst}; let x = AtomicUsize::new(0); let a = x.load(SeqCst); x.store(a + 1, SeqCst); println!("{}", x.load(SeqCst));}