Fox a LOR of sleep and sched_lock by using a timeout wait

when process reaches maximum number of threads.

MFC after: 3 days
This commit is contained in:
David Xu 2005-09-30 06:09:41 +00:00
parent 0b5efa8ad4
commit 763a429571
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150743
2 changed files with 1 additions and 8 deletions

View File

@ -1341,7 +1341,7 @@ thread_userret(struct thread *td, struct trapframe *frame)
break;
mtx_unlock_spin(&sched_lock);
if (msleep(&p->p_numthreads, &p->p_mtx, PPAUSE|PCATCH,
"maxthreads", 0)) {
"maxthreads", hz/10) != EWOULDBLOCK) {
mtx_lock_spin(&sched_lock);
break;
} else {

View File

@ -492,13 +492,6 @@ thread_exit(void)
/* XXX first arg not used in 4BSD or ULE */
sched_exit_thread(FIRST_THREAD_IN_PROC(p), td);
/*
* as we are exiting there is room for another
* to be created.
*/
if (p->p_maxthrwaits)
wakeup(&p->p_numthreads);
/*
* The test below is NOT true if we are the
* sole exiting thread. P_STOPPED_SNGL is unset