Acquire the process mutex and spin locks before calling thread_exit() in
kthread_exit() to fix panics when using INVARIANTS.
This commit is contained in:
parent
c54a45c99c
commit
b113160d81
@ -317,14 +317,21 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p,
|
||||
void
|
||||
kthread_exit(void)
|
||||
{
|
||||
/* a module may be waiting for us to exit */
|
||||
struct proc *p;
|
||||
|
||||
/* A module may be waiting for us to exit. */
|
||||
wakeup(curthread);
|
||||
|
||||
/*
|
||||
* We could rely on thread_exit to call exit1() but
|
||||
* there is extra work that needs to be done
|
||||
*/
|
||||
if (curthread->td_proc->p_numthreads == 1)
|
||||
kproc_exit(0); /* never returns */
|
||||
|
||||
p = curthread->td_proc;
|
||||
PROC_LOCK(p);
|
||||
PROC_SLOCK(p);
|
||||
thread_exit();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user