Volatile vs VolatileRead/Write?

You should never use Thread.VolatileRead/Write(). It was a design mistake in .NET 1.1, it uses a full memory barrier. This was corrected in .NET 2.0, but they couldn't fix these methods anymore and had to add a new way to do it, provided by the System.Threading.Volatile class. Which is a class that the jitter is aware of, it replaces the methods at jit time with a version that's suitable for the specific processor type.

http://stackoverflow.com/questions/15039188/volatile-vs-volatileread-write

原文地址:https://www.cnblogs.com/Googler/p/3214302.html