...
According to the Java Language Specification, §17.7, "Non-Atomic Treatment of double
and long
" [JLS 2005]:
This behavior is implementation specific; Java virtual machines are free to perform writes to
long
anddouble
values atomically or in two parts. For the purposes of the Java programming language memory model, a single write to a non-volatilelong
ordouble
value is treated as two separate writes: one to each 32-bit half. This can result in a situation where a thread sees the first 32 bits of a 64-bit value from one write, and the second 32 bits from another write.
...
Bibliography
3.1.2, Non-atomic 64-Bit Operations | |
| |
[JLS 2005] | §17.7, Non-atomic Treatment of double and long |
...