[racket] running cleanup proc. on process shutdown

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Sep 15 13:25:24 EDT 2010

At Wed, 15 Sep 2010 10:10:20 -0700, John Clements wrote:
> 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?

You can't in the case that Racket is forced to abort, but
scheme_add_atexit_closer() gets as close as possible.

> 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.

Something must be wrong with the OS if forcing an application to
terminate can cause resources to become unavailable until a reboot, but
that's not your problem.



Posted on the users mailing list.