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>
This commit is contained in:
@@ -597,13 +597,12 @@ int pthread_join(pthread_t thid, void ** ret_val)
|
|||||||
|
|
||||||
for (thread = gThreadList; thread != NULL; thread = thread->next)
|
for (thread = gThreadList; thread != NULL; thread = thread->next)
|
||||||
if (thread == (pthread_internal_t*)thid)
|
if (thread == (pthread_internal_t*)thid)
|
||||||
break;
|
goto FoundIt;
|
||||||
|
|
||||||
if (!thread) {
|
|
||||||
pthread_mutex_unlock(&gThreadListLock);
|
pthread_mutex_unlock(&gThreadListLock);
|
||||||
return ESRCH;
|
return ESRCH;
|
||||||
}
|
|
||||||
|
|
||||||
|
FoundIt:
|
||||||
if (thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) {
|
if (thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) {
|
||||||
pthread_mutex_unlock(&gThreadListLock);
|
pthread_mutex_unlock(&gThreadListLock);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user