diff options
| author | Mike Makonnen <mtm@FreeBSD.org> | 2004-03-29 13:53:43 +0000 |
|---|---|---|
| committer | Mike Makonnen <mtm@FreeBSD.org> | 2004-03-29 13:53:43 +0000 |
| commit | b321aa98885ff8ea8dfad098973baae8849ff748 (patch) | |
| tree | 7998eb57026e91c5f6a9cea2fee90708bc54da45 /lib/libthr/thread | |
| parent | 8c223652fbfc2edf203b28b5886e436126b8caf0 (diff) | |
Notes
Diffstat (limited to 'lib/libthr/thread')
| -rw-r--r-- | lib/libthr/thread/thr_join.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c index b96eedc66cca..fd7cff5b3127 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. */ |
