Quantcast
Channel: Volatile vs VolatileRead/Write? - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by Rajnikant for Volatile vs VolatileRead/Write?

To Elaborate more on aleroot's answer.Volatile.Read and Volatile.Write are same as volatile modifier as Royi Namir's argument. But you can use them wisely.For example if you declare a field with...

View Article



Answer by Hans Passant for 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...

View Article

Answer by usr for Volatile vs VolatileRead/Write?

Why the line int num = address; is there ? they already have the address argument which is clearly holding the value.address is not an int. It is an int* (so it really is an address). The code is...

View Article

Answer by aleroot for Volatile vs VolatileRead/Write?

When you need more fine grained control over the way fences are applied to the code can you can use the staticThread.VolatileRead or Thread.VolatileWrite .Declaring a variable volatile means that the...

View Article

Volatile vs VolatileRead/Write?

I can't find any example of VolatileRead/write (try...) but still: When should I use volatile vs VolatileRead?AFAIK the whole purpose of volatile is to create half fences so:For a READ operation,...

View Article

Browsing all 5 articles
Browse latest View live


Latest Images