Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

atomic type

A number the hardware can update in one indivisible step, safely from many threads.

std::sync::atomic types (AtomicUsize, AtomicBool...) provide lock-free load, store and read-modify-write operations such as fetch_add, each with a memory ordering.

Loading interactive…

Examples

  • Two threads each calling scanned.fetch_add(1, Ordering::Relaxed) 1,000 times on one AtomicUsize always end at 2,000, with no lock.

Read the full section →