[concurrency-interest] Atomic.*lazyGet

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Aug 8 09:54:48 EDT 2012

On 08/08/2012 05:22 PM, Doug Lea wrote:
> On 08/08/12 08:29, Aleksey Shipilev wrote:
>> In short, I would like us to consider adding lazyGet() to our atomic
>> primitives. Googling around haven't got me to any pointers if anyone had
>> considered this before. If anyone had, please point me there.
> See previous list discussions of "weakGet()" (which is a better name,
> in line with weakCompareAndSet), at least as far back as 2006.
> For example:
> http://cs.oswego.edu/pipermail/concurrency-interest/2006-May/002526.html

Ah, thanks for the link. I had clearly googled for a different name. I'd
expect search engines to pick up "lazyGet" as well now.

> The lazySet case, that we did add without incorporation into JMM, was
> different in that we were confident that we could spec
> it formally without breaking things in a minor JMM revision
> when it came up next. 

But it is still not formalized, right? If we blow lazySet() by saying
"lazySet() is like naked write without HB semantics", why can't we just
say "weakGet() is like naked read without HB semantics"? No strings
attached. Granted, this is the wizardry stuff, but it is probably easier
than to introduce Fences and require revamping JMM to fit it there.

In fact, I would have done the similar thing by hand, if only VM could
provide me with the appropriate intrinsic. It seems to be better
engineering route to justify this addition with having the API exposing
it, but probably it is too much to ask? Should we instead go for
Unsafe-only route?


More information about the Concurrency-interest mailing list