summaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread_exit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/bionic/pthread_exit.cpp')
-rw-r--r--libc/bionic/pthread_exit.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp
index 9603a79..d0d64b0 100644
--- a/libc/bionic/pthread_exit.cpp
+++ b/libc/bionic/pthread_exit.cpp
@@ -99,6 +99,9 @@ void pthread_exit(void* return_value) {
// pthread_internal_t is freed below with stack, not here.
_pthread_internal_remove_locked(thread, false);
free_mapped_space = true;
+ } else {
+ // Mark the thread as exiting without freeing pthread_internal_t.
+ thread->attr.flags |= PTHREAD_ATTR_FLAG_ZOMBIE;
}
pthread_mutex_unlock(&g_thread_list_lock);