Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 and double values atomically or in two parts. For the purposes of the Java programming language memory model, a single write to a non-volatile long or double 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.

...

MITRE CWE

CWE-667. Improper Locking

Bibliography

[Goetz 2006]

3.1.2, Non-atomic 64-Bit Operations

[Goetz 2004c]

 

[JLS 2005]

§17.7, Non-atomic Treatment of double and long

...