Re: JavaMemoryModel: Finalization idioms

From: Hans Boehm (
Date: Sun May 01 2005 - 14:43:27 EDT

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. But
if the write is to a volatile field, which is read in the finalizer,
then I believe that all reads in the finalizer happen after all
writes in the method, which is what you want.

On Sun, 1 May 2005, Sylvia Else wrote:

> >2) Write to a volatile field at the end of ordinary methods,
> >and read it first thing in the finalizer.
> I don't believe this works in the model as released, because of the absence
> of anything that ensures that the read in the finalizer happens-after the
> write in the method.
> Sylvia.
> -------------------------------
> JavaMemoryModel mailing list -
JavaMemoryModel mailing list -

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