Explain the sigprocmask in pthread_exit.
Also remove the SIGSEGV special case, which was probably because hand-written __exit_with_stack_teardown stubs used to try to cause SIGSEGV if the exit system call returned (which it never does, so that dead code disappeared). Also move the sigprocmask into the only case where it's necessary --- the one where we unmap the stack that would be used by a signal handler. Change-Id: Ie40d20c1ae2f5e7125131b6b492cba7a2c6d08e9
This commit is contained in:
@@ -175,7 +175,7 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
|
||||
}
|
||||
} else {
|
||||
// The caller did provide a stack, so remember we're not supposed to free it.
|
||||
thread->attr.flags |= PTHREAD_ATTR_FLAG_USER_STACK;
|
||||
thread->attr.flags |= PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK;
|
||||
}
|
||||
|
||||
// Make room for the TLS area.
|
||||
@@ -202,7 +202,7 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
|
||||
int tid = __pthread_clone(start_routine, child_stack, flags, arg);
|
||||
if (tid < 0) {
|
||||
int clone_errno = errno;
|
||||
if ((thread->attr.flags & PTHREAD_ATTR_FLAG_USER_STACK) == 0) {
|
||||
if ((thread->attr.flags & PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK) == 0) {
|
||||
munmap(thread->attr.stack_base, thread->attr.stack_size);
|
||||
}
|
||||
free(thread);
|
||||
|
||||
Reference in New Issue
Block a user