bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lib/poll.c bug?


From: Eric Blake
Subject: Re: lib/poll.c bug?
Date: Thu, 30 Jun 2011 11:51:02 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 06/29/2011 11:31 AM, Erik Faye-Lund wrote:
> POSIX says the following about poll "A value of 0 indicates that the
> call timed out and no file descriptors have been selected.". My
> interpretation is that a return value of 0 would be illegal when
> timeout = -1.
> 
> But when I call poll(..., -1), it seems 0 is returned under some
> conditions. Looking through the code, it seems that there isn't any
> efforts to enforce this paragraph; perhaps the included patch is
> appropriate?
> 
> This problem currently affects a feature-branch I have against Git for
> Windows, where this cause a program not to consume input because it
> assumes that poll(..., -1) cannot return 0. The patch fixes it for me.

I think there's a bigger problem here, which is that there is no way to
poll on pipes without busy-waiting, at least not with our current poll
replacement code.  Your patch would turn poll into a 100% cpu hog in the
cases where it is now returning 0.

See this previous discussion:
http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00010.html

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]