From a02a9868abbfe881efd4b7b37d98eaffd6fd9be3 Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Fri, 2 May 2008 11:10:52 +0800 Subject: [PATCH] read race fixed. Signed-off-by: Guanqun Lu --- lib/pipe.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/pipe.c b/lib/pipe.c index 85f5f40..b7e4f66 100644 --- a/lib/pipe.c +++ b/lib/pipe.c @@ -90,9 +90,15 @@ _pipeisclosed(struct Fd *fd, struct Pipe *p) // everybody left is what fd is. So the other end of // the pipe is closed. - if (pageref(fd) == pageref(p)) - return 1; - return 0; + int runs, r; + do { + runs = env->env_runs; + r = 0; + if (pageref(fd) == pageref(p)) + r = 1; + } while (runs != env->env_runs); + + return r; } int -- 2.11.4.GIT