[jmm-dev] weakCompareAndSet memory semantics

Doug Lea dl at cs.oswego.edu
Wed Apr 20 13:25:13 UTC 2016


On 04/20/2016 08:58 AM, Aleksey Shipilev wrote:

> This raises the naming questions, which will be cast in stone in
> VarHandles public API:
>
> a)
>    weakCompareAndSet (relaxed!)
>    weakCompareAndSetAcquire
>    weakCompareAndSetRelease
>    weakCompareAndSetVolatile
>
> (This provides the symmetry against j.u.c, and does not require re-spec,
> just adding a new method)

Let's do it this way. The only downside I can imagine is that some
C++ programmer converting to Java using an an IDE with autocomplete
might select it by mistake without reading the JavaDoc.

-Doug


>
> ...or
>
> b)
>
>    weakCompareAndSet (volatile!)
>    weakCompareAndSetAcquire
>    weakCompareAndSetRelease
>    weakCompareAndSetRelaxed/Plain
>
> (This provides the symmetry against default mem_ord in C++, and also new
> CompareAndExchange{epsilon, Acquire, Release}).
>
> Thanks,
> -Aleksey
>
>
>
>
>
>



More information about the jmm-dev mailing list