[concurrency-interest] AtomicReference.updateAndGet() mandatory updating

Martin Buchholz martinrb at google.com
Wed May 31 21:29:45 EDT 2017


On Wed, May 31, 2017 at 5:06 AM, Doug Lea <dl at cs.oswego.edu> wrote:

> On 05/31/2017 07:03 AM, Doug Lea wrote:
>
> >>
> >> C++ clearly specifies "CAS classic". There is no way to specify
> >> release semantics for a failed CAS, since there is no write.
> >
> > The current C++ spec, sec 29.2 includes versions that do so,
>
> Except that memory_order_release is specifically disallowed.
> Not that it matters, since the question at hand is about
> volatile/seq_cst.


The fact that  memory_order_release is specifically disallowed "proves"
that Hans is right that this is referring to the semantics of the read
alone.

Please please make the semantics of CAS in Java as close as possible to
C++.  In particular, don't make them more expensive for no good reason.

The volatile read in CAS failure alone ensures that the CAS is a
sequentially consistent synchronization action (part of the total order of
all such actions).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20170531/349297bf/attachment.html>


More information about the Concurrency-interest mailing list