[gclist] Guardians

Fergus Henderson fjh@cs.mu.oz.au
Fri, 11 Apr 1997 16:31:28 +1000 (EST)


Carl Bruggeman wrote:
> 
> Hans Boehm wrote:
> > The default behavior should be to err on the side of safety.  In the
> > presence of topologically ordered finalization, you (on rare occasions)
> > do need a mechanism that corresponds to explicitly clearing pointers. 
> > That allows you to use other orderings when you have to.
> 
> I believe that this confirms that topological ordering is not always
> the correct order.  You explicitly clear pointers to change the order
> of finalization (requiring global knowledge of the dependencies on the
> part of the programmer to do so), while we advocate using multiple
> guardian queues to handle finalization dependencies. 

Explicitly using weak pointers or "weak-for-finalization" pointers
(pointers which are ignored when determining finalization order) does
not require global knowledge of the dependencies.  To declare a
particular pointer which is a member of type A as "weak-for-finalization",
all you need to know is that the finalizer for type A will still work
if that pointer has been cleared because the object it points to has
already been finalized.  This can be determined by looking at the code
for A's finalizer.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.