mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-11 23:17:34 +02:00
Fixing exception handlers for threadless builds.
This commit is contained in:
parent
a61cebb1e9
commit
6af5f46721
1 changed files with 16 additions and 7 deletions
|
@ -890,13 +890,22 @@
|
|||
(define (raise-continuable exn)
|
||||
(raise (list *continuable* exn)))
|
||||
|
||||
(define (%with-exception-handler handler thunk)
|
||||
(let* ((old (thread-parameters))
|
||||
(new (cons (cons current-exception-handler handler) old)))
|
||||
(dynamic-wind
|
||||
(lambda () (thread-parameters-set! new))
|
||||
thunk
|
||||
(lambda () (thread-parameters-set! old)))))
|
||||
(cond-expand
|
||||
(threads
|
||||
(define (%with-exception-handler handler thunk)
|
||||
(let* ((old (thread-parameters))
|
||||
(new (cons (cons current-exception-handler handler) old)))
|
||||
(dynamic-wind
|
||||
(lambda () (thread-parameters-set! new))
|
||||
thunk
|
||||
(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)
|
||||
(letrec ((orig-handler (current-exception-handler))
|
||||
|
|
Loading…
Add table
Reference in a new issue