From 8c642599bdadadcb80c8cc1d50e9e415ec165c3c Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 29 Aug 1995 23:17:08 +0000 Subject: (pipe_select): New function. --- libpipe/pipe.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'libpipe') 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); -- cgit v1.2.3