RE: JavaMemoryModel: Finalization idioms

From: David Holmes (dholmes@dltech.com.au)
Date: Sat Apr 30 2005 - 23:27:09 EDT


Bob Lee writes:
> My point is that the empty synchronization blocks won't prevent the
> finalizer from running before the other methods have completed, nor
> will the volatile field accesses in #2. Am I missing something?

You are missing something. The empty sync block forces the object to be
reachable and so the finalizer can not run prior to the sync block
completing execution.

Cheers,
David Holmes

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



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