After forking and initializing the library to single-threaded

mode (where the forked thread is the one and only thread and
is marked as system scope), set the system scope flag before
initializing the signal mask.  This prevents trying to use
internal locks that haven't yet been initialized.

Reported by:	Dan Nelson <dnelson at allantgroup.com>
Reviewed by:	davidxu
This commit is contained in:
deischen 2004-04-08 23:16:21 +00:00
parent 9d70c1606d
commit 6920f21350
2 changed files with 6 additions and 4 deletions

View File

@ -347,13 +347,14 @@ _kse_single_thread(struct pthread *curthread)
_thr_signal_deinit();
}
__isthreaded = 0;
curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
/*
* Restore signal mask early, so any memory problems could
* dump core.
*/
sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
_thr_active_threads = 1;
#endif
}

View File

@ -347,13 +347,14 @@ _kse_single_thread(struct pthread *curthread)
_thr_signal_deinit();
}
__isthreaded = 0;
curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
/*
* Restore signal mask early, so any memory problems could
* dump core.
*/
sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL);
curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;
curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;
_thr_active_threads = 1;
#endif
}