Subj : Re: [.NET] Volatile Fields [correction] To : comp.programming.threads From : Alexander Terekhov Date : Mon Sep 19 2005 09:48 pm David Schwartz wrote: > > "Cool Guy" wrote in message > news:1cgq3c5ccqz6r.dlg@cool.guy.abc.xyz... > > > David Hopwood wrote: > > >> The write to Y is not performed as a single atomic event; it has to be > >> modelled > >> as two events: "Y = 1 is performed with respect to processor 2" and "Y = > >> 1 is > >> performed with respect to processor 3". So it can happen that processor 2 > >> sees > >> Y == 1 before writing Z = 1, but processor 3 does not see Y == 1 until > >> after > >> it sees Z == 1. > > > > > > > > So it's impossible to make such code thread-safe, then? > > With memory barriers, yeah. Just use mutexes or other *appropriate* > synchronization mechanisms. ;) http://www.opengroup.org/austin/mailarchives/ag/msg08586.html regards, alexander. .