[racket-dev] Thread exit status
Hi all,
What do people think of the idea of threads preserving their exit status?
The exit status would be either
- a raised exception, or
- a normally-returned value, or
- nothing as yet, because the thread is still running.
(thread-died-with-exception? thd) -> boolean?
Returns #t if thd died from a raised exception, #f if thd exited
through a normal return, or raises exn:fail:contract if thd hasn't
exited yet.
(thread-exception thd) -> (or/c exn? false?)
Returns the exception that killed thd, #f if the thread returned
normally, or raises exn:fail:contract if thd hasn't exited yet.
(thread-result thd) -> any?
Returns the value that thd's thunk returned, or raises
exn:fail:contract if either thd hasn't exited yet or thd died from
a raised exception.
The existing (thread-dead?) and (thread-dead-evt) would be used
unchanged. (Hmm - if a thread was killed, what would
(thread-died-with-exception?) return?)
Would it be difficult to implement? It'd require a change to the C code.
Regards,
Tony