Let g_thread_list_lock only protect g_thread_list.
As glibc/netbsd don't protect access to thread struct members by a global
lock, we don't want to do it either. This change reduces the
responsibility of g_thread_list_lock to only protect g_thread_list.
Bug: 19636317
Change-Id: I897890710653dac165d8fa4452c7ecf74abdbf2b
diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp
index 81cc67b..c2232a9 100644
--- a/libc/bionic/pthread_exit.cpp
+++ b/libc/bionic/pthread_exit.cpp
@@ -100,9 +100,7 @@
__set_tid_address(NULL);
// pthread_internal_t is freed below with stack, not here.
- pthread_mutex_lock(&g_thread_list_lock);
- _pthread_internal_remove_locked(thread, false);
- pthread_mutex_unlock(&g_thread_list_lock);
+ __pthread_internal_remove(thread);
if (thread->mmap_size != 0) {
// We need to free mapped space for detached threads when they exit.