[plt-scheme] Re: Finalizer or custodian for extension's resources?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jul 15 10:10:13 EDT 2003

At Tue, 15 Jul 2003 15:53:44 +0200, Dirk Gerrits wrote:
> Thanks for your private e-mail Matthew. Having the custodian call 
> scheme_register_finalizer(p,0,0,0,0) to remove the finalizer did the trick.

Oops --- I meant to reply to the list.

For the list archive, here's a little extra explanation to go with the
note above:

 At Tue, 15 Jul 2003 02:25:57 +0200, Dirk Gerrits wrote:
 > There's still a problem though. ~Foo() should only be called *once* per
 > Foo(). How would I go about doing that? Should the finalizer remove the
 > custodian and vice versa? 

 Just vice-versa. The custodian drops its reference to the object if the
 object is finalized. The finalization engine doesn't know about
 custodians, though.

 (Use scheme_register_finalizer() will NULL arguments to remove a
 finalizer installed with scheme_register_finalizer().)


Posted on the users mailing list.