On Apr 21, 2004, at 5:24 AM, Bart Jacobs wrote:
> Personally, I like the idea of a GC.KeepAlive method, as in the .NET
> The rule would be: the finalizer for object O happens-after every
> GC.KeepAlive call for object O. (Or, more specifically: after a point
> where no GC.KeepAlive call could possibly follow if no finalizers were
> So, after each access of the "global data structure" (e.g. an operation
> on the file), the programmer must insert a GC.KeepAlive call. This is
> nice, simple and explicit, and the overhead is acceptable.
We talked about this before. We never reached a consensus at a level
required to force an API change,
and now it is too late to add a new method to the API.
We do guarantee that you can achieve this by either synchronizing on
the object after
updating it, and synchronizing on it again in the finalizer, or
writing to a volatile field of the object after updating it, and
field in the finalizer.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:05 EDT