[racket] Callback on shutdown

From: Tony Garnock-Jones (tonyg at ccs.neu.edu)
Date: Sun May 4 15:29:23 EDT 2014

Hi all,

I'm looking for an atexit()-like facility for Racket.

I've tried setting the exit-handler, but it only seems to be called when
I explicitly call exit, and not implicitly when Racket shuts down when
control flows off the end of the main program.

The problem I'm facing is to buffer rows to insert into a database, and
every few tens of milliseconds flush the buffer, thereby increasing
insertion performance.

However, I don't want to have waiting buffered rows lost at the end of
the program.

I'd like to be able to avoid having to explicitly flush the buffer
before exiting the program, so I'd like to make some kind of
atexit()-alike do it for me.

Any suggestions?

Tony

Posted on the users mailing list.