am 0c3d21e6: am e480fc83: bionic: fix pthread_{create, exit}/signal race condition

* commit '0c3d21e63c6e75ae73aaf2b8d64af0bd8caa6beb':
  bionic: fix pthread_{create, exit}/signal race condition
This commit is contained in:
Jack Ren
2011-11-30 10:50:59 -08:00
committed by Android Git Automerger
2 changed files with 6 additions and 1 deletions

View File

@@ -568,6 +568,7 @@ void pthread_exit(void * retval)
void* stack_base = thread->attr.stack_base;
int stack_size = thread->attr.stack_size;
int user_stack = (thread->attr.flags & PTHREAD_ATTR_FLAG_USER_STACK) != 0;
sigset_t mask;
// call the cleanup handlers first
while (thread->cleanup_stack) {
@@ -610,6 +611,10 @@ void pthread_exit(void * retval)
pthread_mutex_unlock(&gThreadListLock);
}
sigfillset(&mask);
sigdelset(&mask, SIGSEGV);
(void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
// destroy the thread stack
if (user_stack)
_exit_thread((int)retval);