[concurrency-interest] jdk9 VarHandle and Fence methods

Doug Lea dl at cs.oswego.edu
Sat Aug 22 10:01:45 EDT 2015

On 08/21/2015 07:39 PM, thurstonn wrote:
> So the current Java 8 JavaDoc has the following in the atomic package:
> "compareAndSet and all other read-and-update operations such as
> getAndIncrement have the memory effects of both reading and writing volatile
> variables."

Thanks for the reminder that j.u.c.atomic package docs will need
some touch-up when we adapt methods/names for the Atomic* classes.

> Also,
> "(Note: on X86 and Sparc, all flavors of CAS map to the same *instruction*,
> but they may all differ on ARM and POWER.) "
> Just to be clear, that instruction is (LOCK) CMPXCHG and requires no before
> or after fences, right?

Yes. (Actually more than one instruction because of different widths for
int vs long etc.)


More information about the Concurrency-interest mailing list