Fix timing problems in *_select() on W32
authorLRN <lrn1986@gmail.com>
Sun, 8 Sep 2013 17:37:37 +0000 (17:37 +0000)
committerLRN <lrn1986@gmail.com>
Sun, 8 Sep 2013 17:37:37 +0000 (17:37 +0000)
commit8171f4b6fc461182023f2f3ffaa82e52d2561b44
treea035b9784d029d5db52f538d58070215506a3dc5
parent294d9ff5696c57f64f9e42109f387d28afbebb03
Fix timing problems in *_select() on W32

1) If timeout is < 1ms, round it up to 1ms, because WaitForMultipleObjects()
   can't wait for time shorter than 1ms (0ms means "don't wait at all").
2) Read data from the wakeup socket before commanding the select thread to
   start selecting. For some reason the socket would be in signalled state
   by the time winsock's select() runs, even though we emptied it the last
   time. So now we empty it beforehand.
   This should prevent us from returning early in some cases.
src/util/network.c