diff options
author | David Turner <digit@android.com> | 2010-03-18 16:42:49 -0700 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2010-03-18 16:42:49 -0700 |
commit | 1825fb5d5f214849e39d95660795a0d3633f8eeb (patch) | |
tree | e80791744a8729b3847a731e7729c385f0ab1af3 | |
parent | c0e464268d381a5575897e6c2de397167d0985db (diff) | |
parent | a28336c73542f5df1c03de4c142070f408e8d5aa (diff) | |
download | bionic-1825fb5d5f214849e39d95660795a0d3633f8eeb.zip bionic-1825fb5d5f214849e39d95660795a0d3633f8eeb.tar.gz bionic-1825fb5d5f214849e39d95660795a0d3633f8eeb.tar.bz2 |
Merge "bionic: on pthread_join(), avoid extra check in case we find the thread"
-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; |