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 ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature