3f0 Subj : Re: [.NET] Volatile Fields To : comp.programming.threads From : Cool Guy Date : Sat Sep 17 2005 10:19 am David Schwartz wrote: >> Shouldn't Test.result be declared as volatile aswell? My understanding is >> that it should because otherwise the write to it in Thread2 might not be >> visible to other threads, since the value may be written to a cache >> instead >> of to main memory. > > It does not have to be on this platform because, as the page says: See, this is where my understanding goes out of the window. From reading that page it seems there's only one issue here: that reads/writes can be re-ordered and thus just making *one* of those fields volatile is sufficient. But my understanding is that that there are in fact *two* (separate) issues here: a. the above; and b. that reads may come from a cache instead of from main memory (and that writes may go to a cache instead of to main memory). . 0