poll: honor the timeout on Win32
commitfb6aa9a54fa455d8e8b9e3971b1738afabab2679
authorEdward Thomson <ethomson@microsoft.com>
Wed, 18 Mar 2015 14:10:41 +0000 (18 10:10 -0400)
committerEdward Thomson <ethomson@microsoft.com>
Wed, 18 Mar 2015 19:01:55 +0000 (18 15:01 -0400)
tree5ea9406e108894104fd44f688d90f7d089809a6d
parentb21930f4d797342b14d1b827498383e7b213caf1
poll: honor the timeout on Win32

Ensure that when passing a pipe, the gnulib poll replacement will not
return 0 before the timeout has passed.

Not obeying the timeout (and merely returning 0) causes pathological
behavior when preparing a packfile for a repository and taking a
long time to do so.  If poll were to return 0 immediately, this would
cause keep-alives to get sent as quickly as possible until the packfile
was created.  Such deviance from the standard would cause megabytes (or
more) of keep-alive packets to be sent.

GetTickCount is used as it is efficient, stable and monotonically
increasing.  (Neither GetSystemTime nor QueryPerformanceCounter have
all three of these properties.)
compat/poll/poll.c