[concurrency-interest] Atomic.*lazyGet

Doug Lea dl at cs.oswego.edu
Wed Aug 8 14:59:51 EDT 2012

On 08/08/12 11:49, Vitaly Davidovich wrote:
> Thanks for the explanation.  On #1, why are arrays challenging/troublesome?

In part because you need both a reference to an array, a,
and an index, i, to access a[i].
If you are reading them both (a and i) under different consistency rules
before accessing a[i], it is easy to be surprised.

> As for #3, people are already reaching for Unsafe to squeeze out performance so
> couldnt fences be considered in the same light?

Yes, that was one argument for introducing them.
I was surprised by the number of people who responded
saying that only people who know how to use Unsafe should
use these methods, and those people can get the effects using
Unsafe anyway, so why bother introducing a new API?


More information about the Concurrency-interest mailing list