On 01/09/13 06:04, Aleksey Shipilev wrote:

I actually have the question about this. What is the usual pattern for
using AtomicLong.VM_SUPPORTS_LONG_CAS? AtomicLong seems to use Unsafe
directly without the checks. AtomicLongFieldUpdater does the checks.
Something is fishy about this whole thing.

Here's the story: Any implementation of Long-CAS on a machine
that does not have any other way to support it is allowed to
emulate by a synchronized block on enclosing object. For the AtomicXFieldUpdaters classes, there was, at the time they were
introduced, no way to express the object to use, so the checks
were done explicitly. I don't think this is even necessary
anymore, but doesn't hurt. Further, I'm not sure that JDK8
is even targeted to any machines that require this kind of
emulation.

-Doug

Reply via email to