From 90492a060687e552d132e837898db38f8ca265db Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 12 Dec 2008 17:22:24 +0000 Subject: [PATCH] avoid timer-killing problem; cust-box might not be set svn: r12791 --- collects/scheme/sandbox.ss | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/collects/scheme/sandbox.ss b/collects/scheme/sandbox.ss index af0312be5a..a480fa44b9 100644 --- a/collects/scheme/sandbox.ss +++ b/collects/scheme/sandbox.ss @@ -270,13 +270,19 @@ (thread (lambda () (sleep sec) (set! r 'time) (kill-thread t))))) (set! r (with-handlers ([void (lambda (e) (list raise e))]) (call-with-values thunk (lambda vs (list* values vs)))))) + ;; The thread might be killed by the timer thread, so don't let + ;; call-in-nested-thread* kill it -- if user code did so, then just + ;; register the request and kill it below. Do this for a + ;; custodian-shutdown to, just in case. (lambda () (unless r (set! r 'kill)) - (kill-thread (current-thread))) + ;; (kill-thread (current-thread)) + ) (lambda () (unless r (set! r 'shut)) - (custodian-shutdown-all (current-custodian))))) - (unless (custodian-box-value cust-box) + ;; (custodian-shutdown-all (current-custodian)) + ))) + (when (and cust-box (not (custodian-box-value cust-box))) (if (memq r '(kill shut)) ; should always be 'shut (set! r 'memory) (format "cust died with: ~a" r))) ; throw internal error below