[concurrency-interest] DCL using Fence Intrinsics

Vitaly Davidovich 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
> loop
>
> *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
> initialized.
> There is not happens before relation between storeFence and reading of
> instance variable.
>
>
>
>
>
> --
> View this message in context:
> http://jsr166-concurrency.10961.n7.nabble.com/DCL-using-Fence-Intrinsics-tp12420p12422.html
> Sent from the JSR166 Concurrency mailing list archive at Nabble.com.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20150312/6a94a2bd/attachment.html>


More information about the Concurrency-interest mailing list