summaryrefslogtreecommitdiff
path: root/lib/select.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-10-25 10:49:41 +0000
committerAndy Wingo <wingo@pobox.com>2015-10-25 10:55:14 +0000
commit95ac2204d9084a01677fff9eb2669c495bd07d3d (patch)
treeb603eaaf67caaab75489478ab51605a70be006fa /lib/select.c
parent1c9e23c0901363ff24c1dc4e085e7ed68cb81e6d (diff)
downloadguile-95ac2204d9084a01677fff9eb2669c495bd07d3d.tar.gz
Revert "Update Gnulib to v0.1-603-g1d16a7b"
This reverts commit 2d4da30fdefbcdb065d4b1f48f2a77d06f69e3c3. This Gnulib update was causing failures related to timezones in stime.c. I tried to fix it by adopting the time_rz module from gnulib but that then caused other failures. We can try again later.
Diffstat (limited to 'lib/select.c')
-rw-r--r--lib/select.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/lib/select.c b/lib/select.c
index 6f519878c..a31f90224 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -1,7 +1,7 @@
/* Emulation for select(2)
Contributed by Paolo Bonzini.
- Copyright 2008-2015 Free Software Foundation, Inc.
+ Copyright 2008-2014 Free Software Foundation, Inc.
This file is part of gnulib.
@@ -82,11 +82,9 @@ typedef DWORD (WINAPI *PNtQueryInformationFile)
#define PIPE_BUF 512
#endif
-static BOOL IsConsoleHandle (HANDLE h)
-{
- DWORD mode;
- return GetConsoleMode (h, &mode) != 0;
-}
+/* Optimized test whether a HANDLE refers to a console.
+ See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */
+#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
static BOOL
IsSocketHandle (HANDLE h)
@@ -254,7 +252,6 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
MSG msg;
int i, fd, rc;
- clock_t tend;
if (nfds > FD_SETSIZE)
nfds = FD_SETSIZE;
@@ -391,10 +388,6 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
/* Place a sentinel at the end of the array. */
handle_array[nhandles] = NULL;
- /* When will the waiting period expire? */
- if (wait_timeout != INFINITE)
- tend = clock () + wait_timeout;
-
restart:
if (wait_timeout == 0 || nsock == 0)
rc = 0;
@@ -415,16 +408,6 @@ restart:
wait_timeout = 0;
}
- /* How much is left to wait? */
- if (wait_timeout != INFINITE)
- {
- clock_t tnow = clock ();
- if (tend >= tnow)
- wait_timeout = tend - tnow;
- else
- wait_timeout = 0;
- }
-
for (;;)
{
ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
@@ -470,16 +453,7 @@ restart:
}
}
- if (rc == 0
- && (wait_timeout == INFINITE
- /* If NHANDLES > 1, but no bits are set, it means we've
- been told incorrectly that some handle was signaled.
- This happens with anonymous pipes, which always cause
- MsgWaitForMultipleObjects to exit immediately, but no
- data is found ready to be read by windows_poll_handle.
- To avoid a total failure (whereby we return zero and
- don't wait at all), let's poll in a more busy loop. */
- || (wait_timeout != 0 && nhandles > 1)))
+ if (rc == 0 && wait_timeout == INFINITE)
{
/* Sleep 1 millisecond to avoid busy wait and retry with the
original fd_sets. */
@@ -489,8 +463,6 @@ restart:
SleepEx (1, TRUE);
goto restart;
}
- if (timeout && wait_timeout == 0 && rc == 0)
- timeout->tv_sec = timeout->tv_usec = 0;
}
/* Now fill in the results. */