From cdd260ab2edafdc520aa4bfc01de21fac1ca130d Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 5 Feb 2003 07:22:37 +0000 Subject: [PATCH] don't wait for x events if any timers fired --- otk/timer.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/otk/timer.cc b/otk/timer.cc index ceee8f2a..4f993616 100644 --- a/otk/timer.cc +++ b/otk/timer.cc @@ -87,6 +87,11 @@ void Timer::dispatchTimers(bool wait) curr->_action(curr->_data); timevalAdd(curr->_timeout, curr->_delay); _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) { @@ -94,9 +99,9 @@ void Timer::dispatchTimers(bool wait) fd = ConnectionNumber(**display); FD_ZERO(&selset); FD_SET(fd, &selset); - if (nearestTimeout(next)) + if (nearestTimeout(next)) { select(fd + 1, &selset, NULL, NULL, &next); - else + } else select(fd + 1, &selset, NULL, NULL, NULL); } } -- 2.39.2