[armedbear-devel] threads, join, clos

Erik Huelsmann ehuels at gmail.com
Sun Apr 25 09:19:24 UTC 2010

Please note that I see value in continuing this discussion, even
though I have committed a version of the patch already: it's not been
released yet and we have an opportunity to settle on the most-useable
API now; changing later always causes pain.



On Sun, Apr 25, 2010 at 2:03 AM, David Kirkman <dkirkman at ucsd.edu> wrote:
> On Sat, Apr 24, 2010 at 3:43 PM, Tobias C. Rittweiler <tcr at freebits.de> wrote:
>> A thread can return multiple values. Will those be returned in list form
>> as primary return value?
> Well, in the original patch it just returned the first value, and the second
> value is the completed/interrupted flag.  That's on obvious error, so I'm
> attaching a new patch that returns all of the values, plus the completed
> interrupted flag (for a function returning (values 1 2) thread-join will now
> return 1, 2, T)
>> SBCL returns the values as multiple values, and signals an error in case
>> it couldn't join. I'm not sure what interface I'd like more. On SBCL,
>> you pretty much always have to wrap HANDLER-CASE around join-thread
>> which makes it unappropriate to use with MAPC.
>> At the project I'm currently working on, I added the following wrapper:
>>  (defun join-thread (thread &key timeout
>>                                  (on-timeout :timeout)
>>                                  (on-failure :error))
>>    ...)
>> The ON-TIMEOUT/FAILURE arguments are returned as primary results, making
>> it potentially ambiguous (does :error come from the return value of the
>> thread or because of a failure?); however the user can specify these
>> values -- and the user should almost always know in what range a
>> thread's return value is going to be -- so it's my humble opinion on how
>> I think JOIN-THREAD should look like. :-)
> I'm not committed to any particular semantics, other than I want thread-join
> to exist in some form!  Naturally, I kind of like the attached patch :)  (and I
> don't know how to get at keyword arguments in a java implemented
> primitive!).
> Is there a proposed threading standard for common lisp, or a de facto
> standard?
> Cheers
> -david
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel

More information about the armedbear-devel mailing list