[plt-scheme] adding to custodian shutdown actions?

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Mon May 21 14:14:03 EDT 2007

spgsql uses mzscheme ports, which are already managed by custodians.
When the custodian that was current when the connection was created gets
shut down, it will close the ports automatically.

Ryan

On Mon, 2007-05-21 at 13:48 -0400, Robert Nikander wrote:
> 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.
> 
> Rob
> 
> 
> > 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
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.