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:
parent
1a601e1eb1
commit
a1fdec3aa1
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user