Fix condition in select which results in busy loop.
The check for current timestamp > start timestamp has an unwelcome side effect: The loop is not left as long as the current timestamp hasn't been incremented. This leads to busy loops of about one tick (10 to 16 ms per MSDN). This fixes https://cygwin.com/ml/cygwin/2016-05/msg00327.html Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
7239bb7b3d
commit
83834110a0
|
@ -211,7 +211,7 @@ select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||||
{
|
{
|
||||||
select_printf ("recalculating us");
|
select_printf ("recalculating us");
|
||||||
LONGLONG now = gtod.usecs ();
|
LONGLONG now = gtod.usecs ();
|
||||||
if (now > (start_time + us))
|
if (now >= (start_time + us))
|
||||||
{
|
{
|
||||||
select_printf ("timed out after verification");
|
select_printf ("timed out after verification");
|
||||||
/* Set descriptor bits to zero per POSIX. */
|
/* Set descriptor bits to zero per POSIX. */
|
||||||
|
|
Loading…
Reference in New Issue