Simplify wakeup1

This commit is contained in:
Frans Kaashoek 2019-07-03 15:38:30 -04:00
parent cee830af24
commit 47e69250d0

View file

@ -529,19 +529,13 @@ sleep(void *chan, struct spinlock *lk)
}
//PAGEBREAK!
// Wake up all processes sleeping on chan,
// where chan is a proc, which is locked.
// Wake up locked parent, used by exit()
static void
wakeup1(struct proc *chan)
wakeup1(struct proc *p)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p == chan && p->state == SLEEPING && p->chan == chan) {
if(p->state != SLEEPING || p->chan != chan)
panic("wakeup1");
p->state = RUNNABLE;
}
if(p->chan == p && p->state == SLEEPING) {
p->state = RUNNABLE;
}
}
// Wake up all processes sleeping on chan. Never