[cpp-threads] Yet another visibility question
Alexander Terekhov
alexander.terekhov at gmail.com
Thu Jan 11 18:19:48 GMT 2007
On 1/11/07, Paul E. McKenney <paulmck at linux.vnet.ibm.com> wrote:
[... AMD x86-64 ...]
> do {
> l = x;
> } while (cmpxchg(&x, l, l) != l);
Regarding providing illusion of remote write atomicity (under
assumption that AMD x86-64 is PC and not TSO) that's no better than
l = cmpxchg(&x, 42, 42); // with LOCK prefix
because (quoting AMD64 Architecture Programmer's Manual Volume 3)
"CMPXCHG always does a read-modify-write on the memory operand. If the
compared operands were unequal, CMPXCHG writes the same value to the
memory operand that was read."
regards,
alexander.
More information about the cpp-threads
mailing list