diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-09-07 17:17:54 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-09-07 17:17:54 +0000 |
commit | e3f30e9c2445d6d30c1b7ab5292ef0b1951c296e (patch) | |
tree | 131534a6cd372611f2e519011d18bcdaa90cce7a /winsup/cygwin | |
parent | c4857613ca26bac707f69fe3414d2bcdd4d977ee (diff) | |
download | newlib-e3f30e9c2445d6d30c1b7ab5292ef0b1951c296e.zip newlib-e3f30e9c2445d6d30c1b7ab5292ef0b1951c296e.tar.gz newlib-e3f30e9c2445d6d30c1b7ab5292ef0b1951c296e.tar.bz2 |
Fri Sep 7 10:53:34 2001 Jason Tishler <jason@tishler.net>
* poll.cc (poll): Change implementation to only call select() when no
invalid file descriptors are specified.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/poll.cc | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cf7a748..b5ca6b5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 7 10:53:34 2001 Jason Tishler <jason@tishler.net> + + * poll.cc (poll): Change implementation to only call select() when no + invalid file descriptors are specified. + Fri Sep 7 10:27:00 2001 Corinna Vinschen <corinna@vinschen.de> * include/limits.h: Define PIPE_BUF. diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index eed4623..ad5784d 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -50,6 +50,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout) memset (write_fds, 0, fds_size); memset (except_fds, 0, fds_size); + bool invalid_fds = false; for (unsigned int i = 0; i < nfds; ++i) if (!cygheap->fdtab.not_open (fds[i].fd)) { @@ -61,14 +62,21 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout) if (fds[i].events & POLLPRI) FD_SET (fds[i].fd, except_fds); } + else + invalid_fds = true; - int ret = cygwin_select (max_fd + 1, read_fds, write_fds, except_fds, - timeout < 0 ? NULL : &tv); + int ret = 0; + if (!invalid_fds) + ret = cygwin_select (max_fd + 1, read_fds, write_fds, except_fds, + timeout < 0 ? NULL : &tv); for (unsigned int i = 0; i < nfds; ++i) { if (!FD_ISSET (fds[i].fd, open_fds)) - fds[i].revents = POLLNVAL; + { + fds[i].revents = POLLNVAL; + ret++; + } else if (cygheap->fdtab.not_open(fds[i].fd)) fds[i].revents = POLLHUP; else if (ret < 0) |