...
The semantics of volatile
explicitly exclude any guarantee of the atomicity of compound operations that involve read-modify-write sequences such as incrementing a value. See guideline rule VNA02-J. Ensure that compound operations on shared variables are atomic for more information.
...
VNA05-EX1: If all reads and writes of 64-bit long
and double
values occur within a synchronized region, the atomicity of the read/write is guaranteed. This requires both that the value is exposed only through synchronized methods in the class, and also that the value is inaccessible from other code (whether directly or indirectly). For more information, see guideline rule VNA02-J. Ensure that compound operations on shared variables are atomic.)
VNA05-EX2: This guideline rule can be ignored for systems that guarantee that 64-bit, long
and double
values are read and written as atomic operations. Note, however, that such guarantees fail to be portable across systems.
...
Any vulnerabilities resulting from the violation of this guideline rule are listed on the CERT website.
...