Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added an intro line

Declaring variables as volatile establishes a happens-before relationship such that a write to the volatile variable is always seen by a subsequent read. These operations appear to be sequentially consistent with respect to each other, although the code as a whole may not be sequential consistent. Consider two threads that are executing some statements:

...