[racket-dev] Thread exit status

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Oct 22 11:14:27 EDT 2011

I don't think any change is necessary, because this can be done as a library:

https://github.com/jeapostrophe/exp/blob/master/ethread.rkt

On Sat, Oct 22, 2011 at 8: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
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93



Posted on the dev mailing list.