Probably the right choice is to install a flush handler with the
current plumber:
(define (thread/wait proc)
(define t (thread proc))
(plumber-add-flush! (current-plumber)
(lambda (h) (thread-wait t)))
t)
That adds a `thread-wait` in the same sense as flushing a stdout buffer
before exiting.
Another possibility is to extend the `executable-yield-handler`, which
the `racket` executable calls just before `exit`:
(define (thread/wait proc)
(define t (thread proc))
(let ([old (executable-yield-handler)])
(executable-yield-handler
(lambda (v)
(thread-wait t)
(old v))))
t)
On difference between those strategies is that a new place won't call
the exectuable yield handler before the place exits, but a place does
tell its plumber to flush everything before exiting. That is, the
executable yield handler is meant to be specific to the whole process,
while plumbers are meant to be a nestable generalization. Another
difference is that the default exit handler triggered by `(exit)`
doesn't try to yield, but it does tell the plumber to flush.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
racket-users...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/racket-users/e67b750a-1d9d-42fa-9712-9c03da54
> 75a8n%
40googlegroups.com.