On 2/12/10, Sam Steingold <sds@...> wrote:
> I suggest that you wait for Vladimir to add this functionality in core.
> thanks for the test case, BTW, I am sure Vladimir will use it :-)
Just committed THREAD-JOIN support (soon will update the docs as well).
MAKE-THREAD accepts :JOINABLE-P (nil is default)
THREAD-JOIN returns two values:
1. list of return values of thread function
2. T/NIL - depending whether the thread has exited normally (T) or was
when the thread is killed via THREAD-INTERRUPT with :FUNCTION T,
thread return values may be set via :ARGUMENTS.
CL-USER> (defparameter *thr* (make-thread (lambda () (loop (sleep 1)))
CL-USER> (thread-interrupt *thr* :function t :arguments '(a b c))
CL-USER> (thread-join *thr*)
(A B C)
and normal exit:
(make-thread (lambda () (truncate 45 6)) :joinable-p t))
All this is tested in mt.tst.