1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-18 15:30:21 +00:00

writers must hold both sched_lock and the process lock; therefore, readers

need only obtain the process lock.
This commit is contained in:
Mike Makonnen 2004-07-12 15:28:31 +00:00
parent 67fd4fce29
commit c21e3b38bd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132039
2 changed files with 5 additions and 10 deletions

View File

@ -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);

View File

@ -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);