[racket-dev] Thread exit status

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Oct 22 13:27:19 EDT 2011

Sound like `delay/thread' might be doing everything you need.



On Oct 22, 2011, at 9:54 AM, Tony Garnock-Jones <tonyg at ccs.neu.edu> wrote:

> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/dev


Posted on the dev mailing list.