Simplify wakeup1
This commit is contained in:
parent
cee830af24
commit
47e69250d0
|
@ -529,17 +529,11 @@ sleep(void *chan, struct spinlock *lk)
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
//PAGEBREAK!
|
||||||
// Wake up all processes sleeping on chan,
|
// Wake up locked parent, used by exit()
|
||||||
// where chan is a proc, which is locked.
|
|
||||||
static void
|
static void
|
||||||
wakeup1(struct proc *chan)
|
wakeup1(struct proc *p)
|
||||||
{
|
{
|
||||||
struct proc *p;
|
if(p->chan == p && p->state == SLEEPING) {
|
||||||
|
|
||||||
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;
|
p->state = RUNNABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue