RE: JavaMemoryModel: correct synchronization

From: David Holmes (dholmes@dltech.com.au)
Date: Sun Feb 22 2004 - 21:58:00 EST


Tony,

Tony Hosking wrote:
> I guess the question is, does the JMM guarantee that T2 sees w == true.
> Since w is not protected by a monitor is it not reasonable to read w
> in T2 before T1 releases M?

AFAIK code motion across sync blocks is prohibited. Hence there is no way to
reorder things such that the read of w can be performed before the write.
Both the write and read of w could move into the respective sync blocks but
that doesn't change anything.

Now where it states this in the spec these days I can't say.

Cheers,
David

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:58 EDT