ninadmg
05/13/2021, 8:58 AMdmitriy.novozhilov
05/13/2021, 9:18 AMx++
// same as
val tmp = x // read
x = x.inc() // read and write
tmp
So anything can happens between those reads and writes.dmitriy.novozhilov
05/13/2021, 9:18 AMvolatile
is JVM concept I recommend you to read about Java Memory Model (JMM)
https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4.2Chantry Cargill
05/13/2021, 9:58 AMephemient
05/13/2021, 5:05 PM