diff --git a/collects/mzlib/thread.rkt b/collects/mzlib/thread.rkt index 0f2b955..ab84274 100644 --- a/collects/mzlib/thread.rkt +++ b/collects/mzlib/thread.rkt @@ -112,8 +112,14 @@ ;; Enable breaking: (when can-break? (break-enabled #t)) - ;; Call the handler - (handler r w)))))]) + ;; Prevent the handler from + ;; killing this custodian, by + ;; creating an intermediary, + ;; but child custodian + (parameterize ([current-custodian + (make-custodian)]) + ;; Call the handler + (handler r w))))))]) ;; Clean-up and timeout thread: (thread (lambda ()