[plt-scheme] adding to custodian shutdown actions?

From: Robert Nikander (nikander at nc.rr.com)
Date: Mon May 21 13:48:09 EDT 2007

Robby Findler wrote:
> You can only add such actions at the low-leve (ie, in C).
> Is the database connection something that you make at the C level already?

No, it's an spgsql connection, which I believe uses a network protocol 
to talk to PostgreSQL, avoiding the C FFI.

Since I am not killing any threads in this case, I can add a 
dynamic-wind that will close any open db connections.  But I was looking 
into other methods that might be better, and trying to understand 
custodians in general.

If threads were getting killed, how to close the connections then? 
Maybe "will executors" as Grant mentioned.


> On 5/21/07, Robert Nikander <nikander at nc.rr.com> wrote:
>> Hi,
>> Is there a way to add a custom cleanup action to those that occur when
>> (custodian-shutdown-all) is called?  Specifically, I have a database
>> connection that I was forgetting to close (I thought GC might close it,
>> but I guess not).  I'm thinking this is the kind of thing that could be
>>   managed by a custodian, but I don't see any procedure like
>> `custodian-register-resource' or `thread-register-cleanup'.
>> Rob

Posted on the users mailing list.