On 06/08/2014 04:32 PM, Eli Zaretskii wrote:
> The gnulib implementation of 'select' for MS-Windows returns
> 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').  This was discussed here in this thread:
> 
>   http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00008.html
> 
> I bumped into this independently today while running the 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.
> 
> I suggest the following changes to work around the issue.  These
> changes also zero out the 'timeout' argument if the timeout period
> expires with no data or signal available; this seems to be what some
> programs (Guile among them) expect.

The reasoning seems sound.
Thanks for the detail.

> +  /* How much is left to wait?  */
> +  if (wait_timeout != INFINITE)
> +    {
> +      wait_timeout = tend - clock ();
> +      if (wait_timeout < 0)
> +     wait_timeout = 0;

Strange indenting here.
More importantly DWORD is an unsigned type according to a quick search,
so the < 0 check is incorrect?

thanks,
Pádraig.

Reply via email to