Subj : Re: [.NET] Volatile Fields [correction] To : comp.programming.threads From : Joe Seigh Date : Thu Sep 22 2005 07:26 pm David Hopwood wrote: > Joe Seigh wrote: >>Lousy performance compared to what? > > > Now that I look at your suggestion more closely, it doesn't appear to work, > so its performance is moot. > > Start with F (fence) == Y == Z == 0. > > P1: F = 1; Y = 1; > P2: if (Y == 1) { (void) F; F = 1; Z = 1; } > P3: if (Z == 1) { (void) F; assert(Y == 1); } > > can fail, e.g. in this execution: > It's a store/store or release memory barrier so it has to be after the stores that you want to be made visible. PC type 2 has global visibility guarantees so you don't need it for that. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .