[cpp-threads] Failed compare-and-swap

Lawrence Crowl Lawrence at Crowl.org
Wed Aug 1 04:57:56 BST 2007


On 7/31/07, Bill Pugh <pugh at cs.umd.edu> wrote:
> I cast my vote for saying that a failed compare and swap or failed
> trylock should have no synchronization semantics.

Even the value-dependent load?

> The only idioms I know of that would depend on failed atomic
> operations having synchronization semantics are so problematical that
> we should do everything we can to discourage people from trying to
> use them.
>
> By giving fail operations semantics, you also rule out possible
> implementation strategies that might be advantageous in some current
> or future platform.

Would memory_order_relaxed be an acceptable default, or do you
want it the only choice?

-- 
Lawrence Crowl



More information about the cpp-threads mailing list