[cpp-threads] Failed compare-and-swap
Herb Sutter
hsutter at microsoft.com
Mon Jul 30 23:29:38 BST 2007
Paul wrote:
> Successful CAS has the specified memory-ordering properties. The
> strong-atomics CAS would have a full fence when successful. A given
> weak-atomics CAS would have the specified memory-ordering properties,
> for example, a relaxed CAS would have no memory-ordering properties.
Right, when I said full fence semantics I meant for strong atomics.
> There are algorithms in which a failed CAS plays a role similar to a
> failed trylock. So it would make quite a bit of sense for a failed CAS
> to have the same memory-ordering semantics that it would have had if
> successful. After all, the common case should be successful CAS! ;-)
Sorry if the answer is obvious: What are some cases where a failed trylock needs ordering semantics?
Herb
More information about the cpp-threads
mailing list