[racket] Callback on shutdown

From: Tony Garnock-Jones (tonyg at ccs.neu.edu)
Date: Sun May 4 16:19:37 EDT 2014

On 05/04/2014 04:11 PM, Robby Findler wrote:
> Sounds to me like you want to wire into the custodian facilities (via
> the ffi I believe) but probably starting with just atexit() itself is
> okay.

Via the FFI! Gosh. That sounds scary.

I did try register-custodian-shutdown from ffi/unsafe/custodian, but (a)
it wasn't called when the program exited normally, and (b) when I called
(custodian-shutdown (current-custodian)), it complained about a blocking
operation in atomic mode or something like that, and abort()ed. I then
explored use of exit-handler instead :-)

Would it make sense to change Racket to ensure the current exit-handler
is called at the end of the main program?

Regards,
  Tony

Posted on the users mailing list.