I have an member variable (int) that is accessed by multiple threads using
Interlocked.Inc rement(), Interlocked.Dec rement(), 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
--
Mark Salsbery
Microsoft MVP - Visual C++
Interlocked.Inc rement(), Interlocked.Dec rement(), 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
--
Mark Salsbery
Microsoft MVP - Visual C++
Comment