summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/devproc.c8
-rw-r--r--sys/src/9/port/proc.c14
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/src/9/port/devproc.c b/sys/src/9/port/devproc.c
index d11937c17..5f777d864 100644
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -908,12 +908,12 @@ procread(Chan *c, void *va, long n, vlong off)
}
lock(&p->exl);
- if(up == p && p->nchild == 0 && p->waitq == 0) {
- unlock(&p->exl);
- error(Enochild);
- }
pid = p->pid;
while(p->waitq == 0) {
+ if(up == p && p->nchild == 0) {
+ unlock(&p->exl);
+ error(Enochild);
+ }
unlock(&p->exl);
sleep(&p->waitr, haswaitq, p);
if(p->pid != pid)
diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c
index a13164d8d..76aa3d0dd 100644
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -1229,15 +1229,15 @@ pwait(Waitmsg *w)
}
lock(&up->exl);
- if(up->nchild == 0 && up->waitq == 0) {
+ while(up->waitq == 0) {
+ if(up->nchild == 0) {
+ unlock(&up->exl);
+ error(Enochild);
+ }
unlock(&up->exl);
- error(Enochild);
+ sleep(&up->waitr, haswaitq, up);
+ lock(&up->exl);
}
- unlock(&up->exl);
-
- sleep(&up->waitr, haswaitq, up);
-
- lock(&up->exl);
wq = up->waitq;
up->waitq = wq->next;
up->nwait--;