[racket] Callback on shutdown

From: Spencer Florence (spencer at florence.io)
Date: Sun May 4 15:55:05 EDT 2014

Would something like dynamic-wind work for you?
http://docs.racket-lang.org/reference/cont.html?q=dynamic-wind#%28def._%28%28quote._~23~25kernel%29._dynamic-wind%29%29


On Sun, May 4, 2014 at 2:29 PM, Tony Garnock-Jones <tonyg at ccs.neu.edu>wrote:

> 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
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140504/1376feb8/attachment-0001.html>

Posted on the users mailing list.