[racket-dev] Thread exit status
10 minutes ago, Tony Garnock-Jones wrote:
> On 2011-10-22 9:53 PM, Eli Barzilay wrote:
> > I'm not following "may not have been started via `delay/thread'"
> > -- in your example you also need to define a new `standard-thread'
> > to start them, so you need something other than `thread' anyway.
>
> You're right. Using standard-thread would let me simplify my
> event-handling code, since standard-threads are threads, whereas
> delay/threads are promises, but it doesn't make much difference.
Right. If you need the thread value, you can do
(delay/thread (send someone (current-thread)))
(I don't want to add something to the promise interface, since it
won't be applicable to all of the promise types.)
> I think my request for threads to remember what killed them may have
> been premature. I hadn't considered the security aspects of the
> situation: it might be a dangerous leak to have exception
> information available to all comers upon mere presentation of a
> thread handle.
>
> There might be a revised design that separates the kill/resume/etc
> capabilities already built-in to thread handles from the reflection
> capability that'd be needed to get information on what killed a
> thread, but absent that, and for now, standard-thread will do fine.
I still don't see why you need to use that when `delay/thread' does
most of the work that you need to do anyway. As a quick example for
an immediate benefit -- your code doesn't handle multiple values, and
`delay/thread' gives you that for free.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!