...
Note, however, that declaring an object volatile is not sufficient to prevent race conditions data races when the object is simultaneously accessed from within two or more threads of execution. Additional memory visibility constraints may necessitate the use of platform-specific constructs such as memory barriers, for example when each of the threads runs on a different processor.
...