M
Mark Salsbery [MVP]
I have an member variable (int) that is accessed by multiple threads using
Interlocked.Increment(), Interlocked.Decrement(), and read directly.
Using volatile gives me "CS0420: a reference to a volatile field will not be
treated as volatile" warnings when using the Interlocked functions, which I
can easily disable with "#pragma warning disable 420".
Should this variable be marked volatile? Is volatile necessary in this
case?
Thanks!
Mark
Interlocked.Increment(), Interlocked.Decrement(), and read directly.
Using volatile gives me "CS0420: a reference to a volatile field will not be
treated as volatile" warnings when using the Interlocked functions, which I
can easily disable with "#pragma warning disable 420".
Should this variable be marked volatile? Is volatile necessary in this
case?
Thanks!
Mark