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

From: Dirk Gerrits (dirk at gerrits.homeip.net)
Date: Tue Jul 15 09:53:44 EDT 2003

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? I don't really know how to accomplish that. I
> guess I could store the Scheme_Custodian_Reference* along with the Foo
> instance. Or perhaps I could store an extra boolean which indicates
> whether the instance has been destroyed or not. Both methods seem like
> kluges though.

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.

Dirk Gerrits

Posted on the users mailing list.