Kotlin's AtomicInteger-backed updateAndGet uses CAS under the hood. What is the defining hardware/JMM property of compareAndSet that a plain volatile write lacks?
val a = java.util.concurrent.atomic.AtomicInteger(0)
val result = a.updateAndGet { it + 1 }