Peter Bex wrote:
Yup, thanks for asking him. It still sucks, though ;)
It does. This is one way to solve it:
#;1> (use srfi-18)
; loading library srfi-18 ...
#;2> (define exception-protect
---> (let ((original-exception-handler (current-exception-handler)))
---> (lambda (thunk)
---> (lambda ()
---> (with-exception-handler original-exception-handler
thunk)))))
#;3> (define (test)
---> (dynamic-wind
---> (lambda ()
---> (print "BEFORE"))
---> (lambda ()
---> (error "die!")
---> (print "NOT PRINTING"))
---> (lambda ()
---> (print "AFTER"))))
#;4> (thread-join! (thread-start! (exception-protect test)))
BEFORE
Error: die!
Call history:
.
.
.
AFTER
#;4>
The key is defining exception-protect in the primordial thread. Then
you can use it wherever you need it.
I'm not knowledgeable enough to wager what kinds of problems it may
cause... and I have a feeling it may cause lots! Or maybe not. So use
it at your own risk.
-Tobia
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users