summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2004-03-29 13:53:43 +0000
committermtm <mtm@FreeBSD.org>2004-03-29 13:53:43 +0000
commit1f163908e4a04272b1901eae8151f32d36ee0796 (patch)
tree7998eb57026e91c5f6a9cea2fee90708bc54da45 /lib/libthr
parent319c9db836accc9a96513774f6e27cc1722922a6 (diff)
downloadFreeBSD-src-1f163908e4a04272b1901eae8151f32d36ee0796.zip
FreeBSD-src-1f163908e4a04272b1901eae8151f32d36ee0796.tar.gz
o Don't explicitly check the thread for NULL. That is the caller's
responsibility. o If a thread is not joinable, the correct return value is EINVAL.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_join.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c
index b96eedc..fd7cff5 100644
--- a/lib/libthr/thread/thr_join.c
+++ b/lib/libthr/thread/thr_join.c
@@ -47,7 +47,7 @@ _pthread_join(pthread_t pthread, void **thread_return)
_thread_enter_cancellation_point();
/* Check if the caller has specified an invalid thread: */
- if (pthread == NULL || pthread->magic != PTHREAD_MAGIC) {
+ if (pthread->magic != PTHREAD_MAGIC) {
/* Invalid thread: */
_thread_leave_cancellation_point();
return(EINVAL);
@@ -85,16 +85,20 @@ _pthread_join(pthread_t pthread, void **thread_return)
}
/* Check if the thread was not found or has been detached: */
- if (thread == NULL ||
- ((pthread->attr.flags & PTHREAD_DETACHED) != 0)) {
- if (thread != NULL)
- UMTX_UNLOCK(&pthread->lock);
+ if (thread == NULL) {
THREAD_LIST_UNLOCK;
DEAD_LIST_UNLOCK;
ret = ESRCH;
goto out;
-
}
+ if ((pthread->attr.flags & PTHREAD_DETACHED) != 0) {
+ UMTX_UNLOCK(&pthread->lock);
+ THREAD_LIST_UNLOCK;
+ DEAD_LIST_UNLOCK;
+ ret = EINVAL;
+ goto out;
+ }
+
if (pthread->joiner != NULL) {
/* Multiple joiners are not supported. */
/* XXXTHR - support multiple joiners. */
OpenPOWER on IntegriCloud