[racket] Notification when window is closed

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Aug 13 09:57:56 EDT 2012

At Sun, 12 Aug 2012 21:50:29 -0600, Michael Wilber wrote:
> Will such custodian shutdown callbacks be run when racket receives a
> SIGTERM?

I think tat would make sense, but Racket doesn't currently try to
handle SIGTERM specially, so it defaults to abort()-like behavior.

Probably Racket should catch SIGTERM and SIGHUP and trigger calls to
new handlers whose default actions call the exit handler. I'll try
making that change.


> On Sun, 12 Aug 2012 20:36:36 -0600, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> > At Sun, 5 Aug 2012 15:02:10 -0600, Matthew Flatt wrote:
> > > Beware that FFI callback memory management is slightly tricky with
> > > scheme_add_managed():
> > 
> > I've added an `ffi/unsafe/custodian' library with a
> > `register-custodian-shutdown' function to make this easier.
> > 
> > The `register-custodian-shutdown' function also helps with a related
> > problem: calling a shutdown callback when Racket exits. Most resources
> > are released when the Racket process exits, but if an explicit release
> > is needed, supply `#:at-exit? #t'.
> > 
> > Of course, while `register-custodian-shutdown' makes custodian
> > registration easier, there are still many low-level issues to consider
> > --- such as the fact that the callback is invoked atomically in an
> > unspecified Racket thread --- which is why it's under `ffi/unsafe'.
> > 
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> > 

Posted on the users mailing list.