Re: JavaMemoryModel: Finalization idioms

From: Sylvia Else (syljmm32@cryogenic.net)
Date: Fri May 06 2005 - 21:54:08 EDT


This reply may have got lost in the middle of some membership changes I made...

At 11:43 AM 1/05/2005 -0700, Hans Boehm wrote:
>It states (I'm quoting from JLS 3rd edition currently available draft,
>section 12.6.1):
>
>"Every pre-finalization write to a field of an object must be visible
>to the finalization of that object."
>
>That statement by itself isn't very useful, in my opinion.

I agree. However, I've finally found the clause I've been looking for for a
while (and possibly not recognising for what it is), in 12.6.1.1

"If x and y are synchronization actions on the same variable or monitor
such that so(x, y) (17.4.4) and y comes-before di, then x must come-before
di."

For the read (of a volatile) in the finalizer not to see the
pre-finalization write, it would have to precede it in the synchronization
order. Since the write comes before some di, this means that the read would
have to come before that same di which rather precludes it being in a
finalizer.

I'll go back to sleep now.

Sylvia.

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



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