when a thread reads a volatile variable, it sees not just the latest change to the volatile, but also the side effects of the code that led up the change
This is mentioned at http://docs.oracle.com/javase/tutorial/essential/concurrency/atomic.html
Can someone please provide an example of this?
This first gave me an impression that the thread that reads a volatile variable will synchronize with the writer thread and wait until the write is done. But that clearly is not the case.
An example would help a lot and be much appreciated.
Thanks, Mustafa