Subj : Re: [.NET] Volatile Fields [correction] To : comp.programming.threads From : Joe Seigh Date : Tue Sep 20 2005 10:54 am David Hopwood wrote: > Joe Seigh wrote: >> >>You don't need the load on the "memory barrier". >> >>W = X = Y = Z = 0; >> >>Processor 1: W = 1; L = 1; X = 1 >>Processor 2: if (X == 1) { Y = 1; L = 1; Z = 1; } >>Processor 3: if (Z == 1) { assert (W == 1 && Y == 1); } >> >>W and Y are stored by two different processors and are seen in order. > > > What are the stores to L for? > > W = X = Y = Z = 0; > > Processor 1: W = 1; X = 1; > Processor 2: if (X == 1) { Y = 1; Z = 1; } > Processor 3: if (Z == 1) { assert (W == 1 && Y == 1); } > > cannot fail the assert (for processor consistency / x86 WB / .NET with volatiles). > W and Y are stores by two different processors. Under processor consistency you aren't guaranteed to see them in order. And I'm talking about processor consistency w/o .NET volatiles. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .