more improvements to all four variants of exits

svn: r13340
This commit is contained in:
Eli Barzilay 2009-01-31 20:06:36 +00:00
parent 4b7e4e4322
commit 3956dc1530

View File

@ -439,47 +439,33 @@
;; works fine first try it without limits (limits imply a nested ;; works fine first try it without limits (limits imply a nested
;; thread/custodian) ;; thread/custodian)
--top-- --top--
(set! ev (make-evaluator 'scheme/base)) (let ()
--eval-- (define (make!) (set! ev (make-evaluator 'scheme/base)))
(kill-thread (current-thread)) =err> "terminated .thread-killed.$" (define (3x2-terminations)
--top-- (t --top-- (make!) --eval--
(set! ev (make-evaluator 'scheme/base)) (kill-thread (current-thread)) =err> "terminated .thread-killed.$"
--eval-- --top-- (make!) --eval--
(custodian-shutdown-all (current-custodian)) (custodian-shutdown-all (current-custodian))
=err> "terminated .custodian-shutdown.$" =err> "terminated .custodian-shutdown.$"
--top-- --top-- (make!) --eval--
(set! ev (make-evaluator 'scheme/base)) (exit) =err> "terminated .exited.$"
--eval-- ;; now test that it's fine when called directly
(exit) =err> "terminated .exited.$" --top--
--top-- (make!)
;; also happens when it's done directly (call-in-sandbox-context ev
(set! ev (make-evaluator 'scheme/base)) (lambda () (kill-thread (current-thread))))
(call-in-sandbox-context ev (lambda () (kill-thread (current-thread)))) =err> "terminated .thread-killed.$"
=err> "terminated .thread-killed.$" (make!)
(set! ev (make-evaluator 'scheme/base)) (call-in-sandbox-context ev
(call-in-sandbox-context ev (lambda () (custodian-shutdown-all (current-custodian))))
(lambda () (custodian-shutdown-all (current-custodian)))) =err> "terminated .custodian-shutdown.$"
=err> "terminated .custodian-shutdown.$" (make!)
(set! ev (make-evaluator 'scheme/base)) (call-in-sandbox-context ev exit) =err> "terminated .exited.$"))
(call-in-sandbox-context ev exit) =err> "terminated .exited.$" (define (test-terminations)
--top-- ;; try without, then with per-expression limits
;; now make sure it works with per-expression limits too (parameterize ([sandbox-eval-limits #f]) (3x2-terminations))
(set! ev (make-evaluator 'scheme/base)) (3x2-terminations))
--eval-- (test-terminations))
(kill-thread (current-thread)) =err> "terminated .thread-killed.$"
--top--
(set! ev (make-evaluator 'scheme/base))
--eval--
(custodian-shutdown-all (current-custodian))
=err> "terminated .custodian-shutdown.$"
--top--
(set! ev (make-evaluator 'scheme/base))
(call-in-sandbox-context ev (lambda () (kill-thread (current-thread))))
=err> "terminated .thread-killed.$"
(set! ev (make-evaluator 'scheme/base))
(call-in-sandbox-context ev
(lambda () (custodian-shutdown-all (current-custodian))))
=err> "terminated .custodian-shutdown.$"
;; when an expression is out of memory, the sandbox should stay alive ;; when an expression is out of memory, the sandbox should stay alive
--top-- --top--