Semantics of VarHandle CAS methods

Doug Lea dl at cs.oswego.edu
Thu Jun 30 11:19:05 UTC 2016


On 06/30/2016 06:38 AM, Martin Buchholz wrote:
> It's not only about naming.
>
> So yes, I'd like the name weakCompareAndSet to be the sequentially
> consistent version, BUT I'd also expect the next more relaxed version to be
> memory_order_acq_rel which we don't provide.

There are a few flavors of C++ CAS/weakCAS that aren't explicitly supported
(also including those with different memory orders on success and failure),
because you can get the effects with combinations of the supplied versions and
explicit fences. Supporting all of them would have added lots of seldom-used
methods.

> I don't have a good intuition about how useful non-sequentially-consistent
> CASes are.

Among other uses, fallible performance counters, and the bases for
combining with fences as above.

-Doug



More information about the core-libs-dev mailing list