don't wait for x events if any timers fired
This commit is contained in:
parent
64ac7d0537
commit
cdd260ab2e
1 changed files with 7 additions and 2 deletions
|
@ -87,6 +87,11 @@ void Timer::dispatchTimers(bool wait)
|
||||||
curr->_action(curr->_data);
|
curr->_action(curr->_data);
|
||||||
timevalAdd(curr->_timeout, curr->_delay);
|
timevalAdd(curr->_timeout, curr->_delay);
|
||||||
_q.push(curr);
|
_q.push(curr);
|
||||||
|
|
||||||
|
/* if at least one timer fires, then don't wait on X events, as there may
|
||||||
|
already be some in the queue from the timer callbacks.
|
||||||
|
*/
|
||||||
|
wait = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait) {
|
if (wait) {
|
||||||
|
@ -94,9 +99,9 @@ void Timer::dispatchTimers(bool wait)
|
||||||
fd = ConnectionNumber(**display);
|
fd = ConnectionNumber(**display);
|
||||||
FD_ZERO(&selset);
|
FD_ZERO(&selset);
|
||||||
FD_SET(fd, &selset);
|
FD_SET(fd, &selset);
|
||||||
if (nearestTimeout(next))
|
if (nearestTimeout(next)) {
|
||||||
select(fd + 1, &selset, NULL, NULL, &next);
|
select(fd + 1, &selset, NULL, NULL, &next);
|
||||||
else
|
} else
|
||||||
select(fd + 1, &selset, NULL, NULL, NULL);
|
select(fd + 1, &selset, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue