From a28336c73542f5df1c03de4c142070f408e8d5aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Fri, 5 Feb 2010 16:21:07 -0200 Subject: [PATCH] bionic: on pthread_join(), avoid extra check in case we find the thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... by using similar logic as used in pthread_detach(). Signed-off-by: André Goddard Rosa --- libc/bionic/pthread.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 8171aac19..7d4056d25 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;