diff options
author | Christopher Faylor <me@cgf.cx> | 2001-09-25 06:19:10 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-09-25 06:19:10 +0000 |
commit | 79776fc2cca50beff0281ccf0db942a0fb170c4a (patch) | |
tree | 356ef7c291177f0f9817055e26cd7bde549df85d /winsup/cygwin/select.cc | |
parent | 54e909976c1f6b06bbc556c1fc26f25b15c1a55c (diff) | |
download | cygnal-79776fc2cca50beff0281ccf0db942a0fb170c4a.tar.gz cygnal-79776fc2cca50beff0281ccf0db942a0fb170c4a.tar.bz2 cygnal-79776fc2cca50beff0281ccf0db942a0fb170c4a.zip |
* select.cc (fhandler_tty_common::ready_for_read): Rewrite to correctly
call peek_pipe.
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r-- | winsup/cygwin/select.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 6520f4b70..bef4e8ac0 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -496,6 +496,7 @@ poll_pipe (select_record *me, fd_set *readfds, fd_set *writefds, set_bits (me, readfds, writefds, exceptfds) : 0; } + int fhandler_pipe::ready_for_read (int fd, DWORD howlong, int ignra) { @@ -745,12 +746,16 @@ fhandler_console::select_except (select_record *s) int fhandler_tty_common::ready_for_read (int fd, DWORD howlong, int ignra) { -#if 0 - if (myself->pgid && get_ttyp ()->getpgid () != myself->pgid && - myself->ctty == ttynum) // background process? - return 1; // Yes. Let read return an error -#endif - return ((fhandler_pipe*)this)->fhandler_pipe::ready_for_read (fd, howlong, ignra); + select_record me (this); + me.fd = fd; + (void) select_read (&me); + while (!peek_pipe (&me, ignra) && howlong == INFINITE) + if (fd >= 0 && cygheap->fdtab.not_open (fd)) + break; + else if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0) + break; + select_printf ("returning %d", me.read_ready); + return me.read_ready; } select_record * |