summaryrefslogtreecommitdiff
path: root/pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'pipe.c')
-rw-r--r--pipe.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pipe.c b/pipe.c
index 7ebe006..c8da428 100644
--- a/pipe.c
+++ b/pipe.c
@@ -61,6 +61,8 @@ pipe_alloc(struct fd **fd1, struct fd **fd2)
void
pipe_close(struct pipe *p, int writeable)
{
+ acquire(&p->lock);
+
if(writeable){
p->writeopen = 0;
wakeup(&p->readp);
@@ -68,6 +70,9 @@ pipe_close(struct pipe *p, int writeable)
p->readopen = 0;
wakeup(&p->writep);
}
+
+ release(&p->lock);
+
if(p->readopen == 0 && p->writeopen == 0)
kfree((char *) p, PAGE);
}