mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-18 06:14:27 +00:00
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
9be53ee86b
commit
cd808cec50
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173658
|
@ -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 a new issue