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:
...