Merge "pthread_exit(): reduce duplication." into main am: aec1f25248
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3103458 Change-Id: I548a372bfa6d4043c1dd17f7d3b409be3114ec72 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
7379926162
1 changed files with 7 additions and 10 deletions
|
@ -133,20 +133,17 @@ void pthread_exit(void* return_value) {
|
|||
|
||||
// pthread_internal_t is freed below with stack, not here.
|
||||
__pthread_internal_remove(thread);
|
||||
|
||||
if (thread->mmap_size != 0) {
|
||||
// We need to free mapped space for detached threads when they exit.
|
||||
// That's not something we can do in C.
|
||||
__notify_thread_exit_callbacks();
|
||||
__hwasan_thread_exit();
|
||||
_exit_with_stack_teardown(thread->mmap_base, thread->mmap_size);
|
||||
}
|
||||
}
|
||||
|
||||
// No need to free mapped space. Either there was no space mapped, or it is left for
|
||||
// the pthread_join caller to clean up.
|
||||
__notify_thread_exit_callbacks();
|
||||
__hwasan_thread_exit();
|
||||
|
||||
if (old_state == THREAD_DETACHED && thread->mmap_size != 0) {
|
||||
// We need to free mapped space for detached threads when they exit.
|
||||
// That's not something we can do in C.
|
||||
_exit_with_stack_teardown(thread->mmap_base, thread->mmap_size);
|
||||
}
|
||||
// No need to free mapped space. Either there was no space mapped,
|
||||
// or it is left for the pthread_join caller to clean up.
|
||||
__exit(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue