Semantics of VarHandle CAS methods
Martin Buchholz
martinrb at google.com
Thu Jun 30 10:38:18 UTC 2016
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.
I was surprised that weakCompareAndSetAcquire actually does relaxed writes
http://download.java.net/java/jdk9/docs/api/java/lang/invoke/VarHandle.html#weakCompareAndSetAcquire-java.lang.Object...-
I don't have a good intuition about how useful non-sequentially-consistent
CASes are.
On Thu, Jun 30, 2016 at 1:00 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>
> > On 30 Jun 2016, at 09:37, Andrew Haley <aph at redhat.com> wrote:
> >
> > On 30/06/16 02:20, Martin Buchholz wrote:
> >> VarHandle.compareAndSet is strong in two ways - non-spurious and
> >> sequentially consistent.
> >>
> >> VarHandle.weakCompareAndSet is weak in both these ways.
> >> (That seems like a mistake to me.
> >> The fact that j.u.c. Atomic classes are a precedent for this seems
> >> unfortunate.)
> >
> > Is your disagreement purely about the name?
>
> I was also wondering if that was the source of disgreement.
>
> Paul.
>
> > We have all of the variants we need.
> >
>
More information about the core-libs-dev
mailing list