]> Savannah Git Hosting - gnulib.git/commit
select: fix waiting on anonymous pipes on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Tue, 10 Jun 2014 21:19:13 +0000 (22:19 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 10 Jun 2014 22:49:53 +0000 (23:49 +0100)
commitaaaf546f290eb87b0113ed8ddbacc1cf2f1e2e57
tree5a8e9f81558a8dfbf1eeac18da570e70fb09068c
parentb0d4fe9539b3c4651bfa6a34af03fe93f69cc72a
select: fix waiting on anonymous pipes on MS-Windows

The existing select() implementation for MS-Windows returned
immediately with a zero value when it is called to wait for input
from an anonymous pipe (e.g., a pipe created by a call to 'pipe' or
'pipe2'), as discussed at:

  http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00008.html

This was noticed while running Guile's test suite on MS-Windows.
Guile uses 'select', among other places, in its implementation
of 'sleep' and 'usleep' primitives.  It calls 'select'
with a file descriptor of a signal delivery pipe, which is written to
(by another thread) when Guile is interrupted by a signal.  But due to
the above-mentioned problem, these two functions never sleep, and
instead return immediately.

* lib/select.c (rpl_select): Fall back to polling when select()
indicates there is nothing to check, while due to the timeout not
expiring, activity is indicated on one of the handles.
Also clear the TIMEOUT argument if the timer does expire.
ChangeLog
lib/select.c