[concurrency-interest] DCL using Fence Intrinsics
vitalyd at gmail.com
Thu Mar 12 20:52:22 EDT 2015
I'm talking about the assignment of 1 to a done by T1. The formatting is a
bit off, so perhaps I'm misreading it.
In 1, the writer has a storeFence between constructor and assignment to
field which prevents reader from seeing the reference before initializing
stores are complete. So, I think the reader sees either null or a fully
constructed object without loadFence. This is basically mimicing what
happens when you publish an instance with final fields racily.
sent from my phone
On Mar 12, 2015 8:21 PM, "vikas" <vikas.vksingh at gmail.com> wrote:
> *In 2, compiler can move a=1 after the loop*
> Not sure what you meant here a==1 is a read operation and already after the
> *For 3, if you put loadFence inside the while loop it will work*
> Not sure why it will work
> *I can't see why you even need the loadFence.*
> Probably without load fence you may not see all fields of Singleton fully
> There is not happens before relation between storeFence and reading of
> instance variable.
> View this message in context:
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest