[cpp-threads] Failed compare-and-swap

Peter Dimov pdimov at mmltd.net
Mon Jul 30 03:23:13 BST 2007


Lawrence Crowl wrote:
> Are the synchronization semantics of a failed compare-and-swap
> any different from those of a successful one?

I think that a failed CAS should not be required to perform any memory 
synchronization.

Making an acquire CAS have acquire semantics in the failure case makes it 
needlessly expensive, and a failed release CAS can't participate in a 
release+acquire handshake since it doesn't store a value (x86 dummy writes 
notwithstanding.) 




More information about the cpp-threads mailing list