diff options
author | André Goddard Rosa <andre.goddard@gmail.com> | 2010-02-05 16:21:07 -0200 |
---|---|---|
committer | André Goddard Rosa <andre.goddard@gmail.com> | 2010-02-05 16:21:07 -0200 |
commit | a28336c73542f5df1c03de4c142070f408e8d5aa (patch) | |
tree | 4e9349481971a8673e098108b5716a23fa59d9b8 | |
parent | 95604529ec25fe7923ba88312c590f38aa5e3d9e (diff) | |
download | bionic-a28336c73542f5df1c03de4c142070f408e8d5aa.zip bionic-a28336c73542f5df1c03de4c142070f408e8d5aa.tar.gz bionic-a28336c73542f5df1c03de4c142070f408e8d5aa.tar.bz2 |
bionic: on pthread_join(), avoid extra check in case we find the thread
... by using similar logic as used in pthread_detach().
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
-rw-r--r-- | libc/bionic/pthread.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 8171aac..7d4056d 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -597,13 +597,12 @@ int pthread_join(pthread_t thid, void ** ret_val) for (thread = gThreadList; thread != NULL; thread = thread->next) if (thread == (pthread_internal_t*)thid) - break; + goto FoundIt; - if (!thread) { - pthread_mutex_unlock(&gThreadListLock); - return ESRCH; - } + pthread_mutex_unlock(&gThreadListLock); + return ESRCH; +FoundIt: if (thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) { pthread_mutex_unlock(&gThreadListLock); return EINVAL; |