Versions Compared

Key

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

...

Wiki Markup
*volatile* : "A write to a volatile field (§8.3.1.4) happens-before every subsequent read of that field" \[[JLS 05|AA. Java References#JLS 05]\]. "Operations on the master copies of volatile variables on behalf of a thread are performed by the main memory in exactly the order that the thread requested." \[[JVMSpec 99|AA. Java References#JVMSpec 99]\]. Declaring a variable {{volatile}} ensures that all threads see a consistentthe most up to date value of the variable, if any thread modifies it. Volatile guarantees atomic reads and writes of primitive values, however, it does not guarantee the atomicity of composite operations such as variable incrementation (read-modify-write sequence).   

...