RE: JavaMemoryModel: Another Java threading issue (finalization)

From: Alexander Terekhov (TEREKHOV@de.ibm.com)
Date: Wed Apr 02 2003 - 03:51:08 EST


Hans Boehm wrote:
[...]
> If objects A and B both have finalizers, A refers to B, and As
> finalizer needs to access B, there is no way to ensure that A will
> be finalized first.

Uhmm, what about the following: introduce post-constructors and pre-
finalizers and legislate that "pre-" stuff should keep invariants
intact and "optionally be prepared" for resurrection. The collector
would ensure two phase processing: the pre-finalizers for all
collected objects would run first, followed by the finalizers (or
post-constructors [kinda "resurrectors"] for the resurrected stuff).
The A's pre-finalizer would then be able to "safely access" B. The
same would also apply to B's pre-finalizer (if any) WRT A. Well,
also: < pls see (g) >

http://www.cs.umd.edu/~pugh/java/memoryModel/archive/1038.html

What do you think? TIA.

regards,
alexander.

--
http://www.google.com/groups?selm=3D23534C.681063DC%40web.de

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



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