[racket] running cleanup proc. on process shutdown

From: John Clements (clements at brinckerhoff.org)
Date: Wed Sep 15 13:10:20 EDT 2010

I'm sure this is in the docs, but my readings of the docs for custodians and will-executors haven't answered it: how can I ensure that a single ffi-built cleanup procedure is called when the Racket/DrRacket process dies?

Specifically, the "portaudio" library contains this dire warning in its include file:

 Pa_Terminate() MUST be called before exiting a program which uses PortAudio.
 Failure to do so may result in serious resource leaks, such as audio devices
 not being available until the next reboot.

My reading of the docs suggests that I want to associate a will-executor with the object representing the audio connection, and then ... start a separate thread (in a parent custodian?) that executes it? The docs appear carefully written to avoid providing any guarantee, which makes me nervous.

Pointers to docs that I've missed gratefully accepted.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20100915/40519852/attachment.p7s>

Posted on the users mailing list.