// Atomic($T).swap — atomic exchange (LLVM atomicrmw xchg): store the new value, // return the OLD one. Stream A (atomics) A.3. Single-thread. #import "modules/std.sx"; #import "modules/std/atomic.sx"; main :: () { a := Atomic(i64).init(7); old := a.swap(42, .acq_rel); print("swap old: {}\n", old); // 7 print("swap now: {}\n", a.load(.acquire)); // 42 }