writers must hold both sched_lock and the process lock; therefore, readers
need only obtain the process lock.
This commit is contained in:
parent
fae9d5166b
commit
8e8f80bd23
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user