From 78c2361d1d9e680230df412f4d1489725781c6d2 Mon Sep 17 00:00:00 2001 From: Gabor Melis Date: Mon, 26 Mar 2007 15:30:02 +0000 Subject: [PATCH] 1.0.4.4: simplify JOIN-THREAD interface --- NEWS | 1 + src/code/target-thread.lisp | 12 +++++------- tests/threads.impure.lisp | 3 +-- version.lisp-expr | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 34d975b..ee9f95d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ;;;; -*- coding: utf-8; -*- changes in sbcl-1.0.5 relative to sbcl-1.0.4: + * minor incompatible change: changed experimental JOIN-THREAD interface * documentation: unwinding from asyncronous events has been documented as unsafe. * documentation: SB-SYS:WITHOUT-GCING has been documented as unsafe diff --git a/src/code/target-thread.lisp b/src/code/target-thread.lisp index 865cac4..57747fc 100644 --- a/src/code/target-thread.lisp +++ b/src/code/target-thread.lisp @@ -694,20 +694,18 @@ around and can be retrieved by JOIN-THREAD." (setf (sb!kernel:fdocumentation 'join-thread-error-thread 'function) "The thread that we failed to join.") -(defun join-thread (thread &key (errorp t) default) +(defun join-thread (thread &key (default nil defaultp)) #!+sb-doc "Suspend current thread until THREAD exits. Returns the result values of the thread function. If the thread does not exit normally, -return DEFAULT or signal JOIN-THREAD-ERROR depending on ERRORP. This -function is experimental and it is likely to be changed in the -future." +return DEFAULT if given or else signal JOIN-THREAD-ERROR." (with-mutex ((thread-result-lock thread)) (cond ((car (thread-result thread)) (values-list (cdr (thread-result thread)))) - (errorp - (error 'join-thread-error :thread thread)) + (defaultp + default) (t - default)))) + (error 'join-thread-error :thread thread))))) (defun destroy-thread (thread) #!+sb-doc diff --git a/tests/threads.impure.lisp b/tests/threads.impure.lisp index 144d3ba..3800bbc 100644 --- a/tests/threads.impure.lisp +++ b/tests/threads.impure.lisp @@ -17,7 +17,7 @@ (use-package "ASSERTOID") (defun wait-for-threads (threads) - (mapc (lambda (thread) (sb-thread:join-thread thread :errorp nil)) threads) + (mapc (lambda (thread) (sb-thread:join-thread thread :default nil)) threads) (assert (not (some #'sb-thread:thread-alive-p threads)))) (assert (eql 1 (length (list-all-threads)))) @@ -55,7 +55,6 @@ (with-test (:name '(:join-thread :nlx :default)) (let ((sym (gensym))) (assert (eq sym (join-thread (make-thread (lambda () (sb-ext:quit))) - :errorp nil :default sym))))) (with-test (:name '(:join-thread :nlx :error)) diff --git a/version.lisp-expr b/version.lisp-expr index 9682fa0..adeed9c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.4.3" +"1.0.4.4" -- 1.7.10.4