As you can see we can take an atomic reference, which is awesome. The memory must be aligned, and the atomic treats the referenced memory as an atomic variable. atomic.exchange() is an optimal swap. But it's std::memory_order_acquire and std::memory_order_acq_rel that are doing the heavy lifting. These result in zero CPU instructions. Instead they just place an ordering constraint on the compiler. And since most CPUs (all we support) implement atomicity for aligned word read/write, we get the atomicity for free also (apart from the head padding). So basically, totally lock and delay free (i.e. no spinlocks, etc) magic.