[armedbear-devel] threads, join, clos

David Kirkman dkirkman at ucsd.edu
Sun Apr 25 00:03:44 UTC 2010

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

Is there a proposed threading standard for common lisp, or a de facto


-------------- next part --------------
A non-text attachment was scrubbed...
Name: thread-join-multiple-values-2.diff
Type: application/octet-stream
Size: 2714 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20100424/c9ddb08d/attachment.obj>

More information about the armedbear-devel mailing list