Re: JavaMemoryModel: Thread starting in constructors

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Tue Mar 12 2002 - 12:08:58 EST


Forwarded message:
>
>
>
> > ... But so do other anomalies.
>
> and how does this relates to:
>
> http://www.cs.umd.edu/~pugh/java/memoryModel/semantics.pdf
>
> "If thread T1 starts thread T2, then all actions visible
> to T1 at the time it starts T2 become visible to T2
> before T2 starts. Similarly, if T1 joins with T2 (waits
> for T2 to terminate), then all accesses visible to T2
> when T2 terminates are visible to T1 after the join
> completes."
>
> <?!>
>
> regards,
> alexander.

That's in the "Proposed Informal Semantics" section. What you are looking
for is actually in section 8.4, "Explicit Thread Communication":

Associated with each thread T1 is a hidden volatile start field. When
thread T2 starts T1, it is as though T2 writes to the start field, and the
very first action taken by T1 is to read that field.

A careful reading of the semantics will indicate that this does not
address the problem of the final field in Bill's example.

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



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