On Sat, Apr 24, 2010 at 1:57 AM, Erik Huelsmann ehuels@gmail.com wrote:
I have one question regarding the patch though: How would the caller know the difference between the scenario where an Interrupted exception occurs and the one where the thread is really joined?
Should we use the return value NIL to signal "not joined" and T for "joined"?
Yes! Here is an updated patch that does that.
The other option for thread-join return values is to have it return the value of the function used in make-thread. That way thread-join will both wait for the thread to finish and collect it's value, and I don't have to set up global variables to collect the results. (Which is the way I always *want* join to work!)
I've included a second patch in which implements join that way. It also returns a second T/NIL value indicating if the thread finished normally or was interrupted. The only disadvantage to this is that in other languages join either returns nothing or a success/failure code.
Cheers,
-david