diff options
author | jhb <jhb@FreeBSD.org> | 2001-04-24 00:51:53 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-04-24 00:51:53 +0000 |
commit | 9c03a8ae91e06e47f0c59996ef0e2300e231e101 (patch) | |
tree | ec00c764b1eb58ed4297070edb5806ffd7ca4765 /sys/kern/sys_generic.c | |
parent | 383dd0a2656889604bb7eb71b993875024ddd832 (diff) | |
download | FreeBSD-src-9c03a8ae91e06e47f0c59996ef0e2300e231e101.zip FreeBSD-src-9c03a8ae91e06e47f0c59996ef0e2300e231e101.tar.gz |
Change the pfind() and zpfind() functions to lock the process that they
find before releasing the allproc lock and returning.
Reviewed by: -smp, dfr, jake
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r-- | sys/kern/sys_generic.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index a779711..9414574 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1034,10 +1034,12 @@ selrecord(selector, sip) mtx_lock_spin(&sched_lock); if (p->p_wchan == (caddr_t)&selwait) { mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(p); sip->si_flags |= SI_COLL; return; } mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(p); } sip->si_pid = mypid; } @@ -1067,12 +1069,9 @@ selwakeup(sip) setrunnable(p); else unsleep(p); - mtx_unlock_spin(&sched_lock); - } else { - mtx_unlock_spin(&sched_lock); - PROC_LOCK(p); + } else p->p_flag &= ~P_SELECT; - PROC_UNLOCK(p); - } + mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(p); } } |