[cpp-threads] Yet another visibility question

Alexander Terekhov alexander.terekhov at gmail.com
Fri Jan 12 09:30:46 GMT 2007


On 1/11/07, Peter Dimov <pdimov at mmltd.net> wrote:
> Alexander Terekhov wrote:
>
> > Yeah, and IBM does some NUMA with Intel Xeons, IIRC. That's why I've
> > been telling all along that lock_cmpxchg(&var, 42, 42) for loads is
> > the way to do SC on x86/IA32. ;-)
>
> If x86 loads do have acquire semantics as we've been assuming, wouldn't it
> be enough to just use lock xchg for stores?

I don't think so. Why would that be enough? Well, actually xchg for
stores is still needed to ensure leading store-load fencing regarding
load inside cmpxchg, I think. So for SC on x86/IA32 we need cmpxchg
for loads and xchg for stores (both locked).

regards,
alexander.



More information about the cpp-threads mailing list