Fixing exception handlers for threadless builds.

This commit is contained in:
Alex Shinn 2013-02-27 20:57:40 +09:00
parent a61cebb1e9
commit 6af5f46721

View file

@ -890,13 +890,22 @@
(define (raise-continuable exn) (define (raise-continuable exn)
(raise (list *continuable* exn))) (raise (list *continuable* exn)))
(cond-expand
(threads
(define (%with-exception-handler handler thunk) (define (%with-exception-handler handler thunk)
(let* ((old (thread-parameters)) (let* ((old (thread-parameters))
(new (cons (cons current-exception-handler handler) old))) (new (cons (cons current-exception-handler handler) old)))
(dynamic-wind (dynamic-wind
(lambda () (thread-parameters-set! new)) (lambda () (thread-parameters-set! new))
thunk thunk
(lambda () (thread-parameters-set! old))))) (lambda () (thread-parameters-set! old))))))
(else
(define (%with-exception-handler handler thunk)
(let ((old (current-exception-handler)))
(dynamic-wind
(lambda () (current-exception-handler handler))
thunk
(lambda () (current-exception-handler old)))))))
(define (with-exception-handler handler thunk) (define (with-exception-handler handler thunk)
(letrec ((orig-handler (current-exception-handler)) (letrec ((orig-handler (current-exception-handler))