I am looking for native analog of VolatileRead/Write.
From: Discussion relating to the specifics of the C# and Managed C++ languages [mailto:DOTNET-CX@DISC...] On Behalf Of Peter Ritchie
Sent: Tuesday, December 11, 2007 23:44
To: DOTNET-CX@DISC... Subject: Re: [DOTNET-CX] Native version of VolatileRead and VolatileWrite
Both VolatileRead/Write and InterockExchange are atomic and perform an
implicit memory barrier.
VolatileRead/Write an CompareExchange accomplish the same thing. What are
you trying to accomplish?
The call to Thread.VolatileWrite in C# should be:
Thread.VolatileWrite(ref val, valueToWrite).
The call to VolatileRead should also not use the C++ scope resolution
operator; but other than that :-).