[plt-scheme] Chaining exception handlers between threads

From: Noel Welsh (noelwelsh at gmail.com)
Date: Mon Feb 25 12:05:38 EST 2008

Hello,

I want to install an exception handler around a number of threads (so
a simple use of call-in-nested-thread will not work).  More precisely,
I want any exception in my threads to kill all the threads and then
raise an exception in the parent thread.  I'm not sure how to
propagate the exn from the child thread to the parent.  The obvious
solution doesn't work:

> (with-handlers ([exn? (lambda (e) (display "got it!"))]) (thread (lambda () (error "died"))))
#<thread>
> died

Do I have to write the communication by hand?

I think this bit of information has fallen through the gaps in
documenting threads, exception, and parameters -- but I'm happy to be
pointed to the page that proves me wrong!

N.


Posted on the users mailing list.