<div dir="ltr">Would something like dynamic-wind work for you?<br><a href="http://docs.racket-lang.org/reference/cont.html?q=dynamic-wind#%28def._%28%28quote._~23~25kernel%29._dynamic-wind%29%29">http://docs.racket-lang.org/reference/cont.html?q=dynamic-wind#%28def._%28%28quote._~23~25kernel%29._dynamic-wind%29%29</a><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, May 4, 2014 at 2:29 PM, Tony Garnock-Jones <span dir="ltr"><<a href="mailto:tonyg@ccs.neu.edu" target="_blank">tonyg@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I'm looking for an atexit()-like facility for Racket.<br>
<br>
I've tried setting the exit-handler, but it only seems to be called when<br>
I explicitly call exit, and not implicitly when Racket shuts down when<br>
control flows off the end of the main program.<br>
<br>
The problem I'm facing is to buffer rows to insert into a database, and<br>
every few tens of milliseconds flush the buffer, thereby increasing<br>
insertion performance.<br>
<br>
However, I don't want to have waiting buffered rows lost at the end of<br>
the program.<br>
<br>
I'd like to be able to avoid having to explicitly flush the buffer<br>
before exiting the program, so I'd like to make some kind of<br>
atexit()-alike do it for me.<br>
<br>
Any suggestions?<br>
<br>
Tony<br>
____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>