pi for pipe, rather than p, to avoid confusion with proc's p->lock

This commit is contained in:
Robert Morris 2019-07-20 17:07:20 -04:00
parent 3333665ab6
commit 06e49a58dc
2 changed files with 51 additions and 58 deletions

View file

@ -510,12 +510,6 @@ sleep(void *chan, struct spinlock *lk)
{
struct proc *p = myproc();
if(p == 0)
panic("sleep");
if(lk == 0)
panic("sleep without lk");
// Must acquire p->lock in order to
// change p->state and then call sched.
// Once we hold p->lock, we can be
@ -543,17 +537,6 @@ sleep(void *chan, struct spinlock *lk)
}
}
//PAGEBREAK!
// Wake up p if it is sleeping in wait(); used by exit().
// Caller must hold p->lock.
static void
wakeup1(struct proc *p)
{
if(p->chan == p && p->state == SLEEPING) {
p->state = RUNNABLE;
}
}
// Wake up all processes sleeping on chan.
// Must be called without any p->lock.
void
@ -570,6 +553,16 @@ wakeup(void *chan)
}
}
// Wake up p if it is sleeping in wait(); used by exit().
// Caller must hold p->lock.
static void
wakeup1(struct proc *p)
{
if(p->chan == p && p->state == SLEEPING) {
p->state = RUNNABLE;
}
}
// Kill the process with the given pid.
// The victim won't exit until it tries to return
// to user space (see usertrap() in trap.c).