diff options
author | mtm <mtm@FreeBSD.org> | 2004-07-12 15:28:31 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-07-12 15:28:31 +0000 |
commit | 8e8f80bd23b814fd62dfaa9cad441cee760e63d3 (patch) | |
tree | 76b0aee1d4081a4c01a07590c3b321c577dff63d /sys | |
parent | fae9d5166b05adb387f7ba91b99498b29b02792f (diff) | |
download | FreeBSD-src-8e8f80bd23b814fd62dfaa9cad441cee760e63d3.zip FreeBSD-src-8e8f80bd23b814fd62dfaa9cad441cee760e63d3.tar.gz |
writers must hold both sched_lock and the process lock; therefore, readers
need only obtain the process lock.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_thr.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_umtx.c | 8 |
2 files changed, 5 insertions, 10 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index d1b5d3f..856e2dc 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -280,13 +280,10 @@ thr_suspend(struct thread *td, struct thr_suspend_args *uap) hz = tvtohz(&tv); } PROC_LOCK(td->td_proc); - mtx_lock_spin(&sched_lock); - if ((td->td_flags & TDF_THRWAKEUP) == 0) { - mtx_unlock_spin(&sched_lock); + if ((td->td_flags & TDF_THRWAKEUP) == 0) error = msleep((void *)td, &td->td_proc->p_mtx, td->td_priority | PCATCH, "lthr", hz); - mtx_lock_spin(&sched_lock); - } + mtx_lock_spin(&sched_lock); td->td_flags &= ~TDF_THRWAKEUP; mtx_unlock_spin(&sched_lock); PROC_UNLOCK(td->td_proc); diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index e1ae68d..1289cd7 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -217,14 +217,12 @@ _umtx_lock(struct thread *td, struct _umtx_lock_args *uap) * unlocking the umtx. */ PROC_LOCK(td->td_proc); - mtx_lock_spin(&sched_lock); - if (old == owner && (td->td_flags & TDF_UMTXWAKEUP) == 0) { - mtx_unlock_spin(&sched_lock); + if (old == owner && (td->td_flags & TDF_UMTXWAKEUP) == 0) error = msleep(td, &td->td_proc->p_mtx, td->td_priority | PCATCH, "umtx", 0); - mtx_lock_spin(&sched_lock); - } else + else error = 0; + mtx_lock_spin(&sched_lock); td->td_flags &= ~TDF_UMTXWAKEUP; mtx_unlock_spin(&sched_lock); PROC_UNLOCK(td->td_proc); |