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.