summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-08-29 23:17:08 +0000
committerMiles Bader <miles@gnu.org>1995-08-29 23:17:08 +0000
commit8c642599bdadadcb80c8cc1d50e9e415ec165c3c (patch)
tree3552db7e1f41d12948cf91778a56a6f522f89b0b
parent444cda60f596ba1769d407bf3e95f7ec8f1a7c8c (diff)
(pipe_select): New function.
-rw-r--r--libpipe/pipe.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/libpipe/pipe.h b/libpipe/pipe.h
index b809c1bf..f9ea243b 100644
--- a/libpipe/pipe.h
+++ b/libpipe/pipe.h
@@ -138,7 +138,20 @@ pipe_wait (struct pipe *pipe, int noblock, int data_only)
}
return 0;
}
-
+
+/* Waits for PIPE to be readable, or an error to occurr. This call only
+ returns once threads waiting using pipe_wait have been woken and given a
+ chance to read, and if there is still data available thereafter. If
+ DATA_ONLY is true, then `control' packets are ignored. */
+extern inline error_t
+pipe_select (struct pipe *pipe, int data_only)
+{
+ while (! pipe_is_readable (pipe, data_only) && ! (pipe->flags & PIPE_BROKEN))
+ if (hurd_condition_wait (&pipe->pending_selects, &pipe->lock))
+ return EINTR;
+ return 0;
+}
+
/* Wake up all threads waiting on PIPE, which should be locked. */
void pipe_kick (struct pipe *pipe);