diff options
author | Robert Morris <rtm@csail.mit.edu> | 2019-07-20 17:07:20 -0400 |
---|---|---|
committer | Robert Morris <rtm@csail.mit.edu> | 2019-07-20 17:07:20 -0400 |
commit | 06e49a58dcc8ba3f898ba5399449312cd129b0fe (patch) | |
tree | 754c9766c8ebb0b23a456b1355f0ed4ee3d2df48 /kernel/proc.c | |
parent | 3333665ab68329543d6c51a1d819dc56e1b7cd5d (diff) | |
download | xv6-labs-06e49a58dcc8ba3f898ba5399449312cd129b0fe.tar.gz xv6-labs-06e49a58dcc8ba3f898ba5399449312cd129b0fe.tar.bz2 xv6-labs-06e49a58dcc8ba3f898ba5399449312cd129b0fe.zip |
pi for pipe, rather than p, to avoid confusion with proc's p->lock
Diffstat (limited to 'kernel/proc.c')
-rw-r--r-- | kernel/proc.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/kernel/proc.c b/kernel/proc.c index e63cc9f..bd39c4b 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -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). |