From a2de94e91e1c0e7775c97745ae11d14e5c5f5659 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 7 Jan 2003 19:24:38 +0000 Subject: in synch mode, chew up 100% cpu, cuz we cant select on the display's fd --- otk/timerqueuemanager.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'otk/timerqueuemanager.cc') diff --git a/otk/timerqueuemanager.cc b/otk/timerqueuemanager.cc index a37fe94d..79335154 100644 --- a/otk/timerqueuemanager.cc +++ b/otk/timerqueuemanager.cc @@ -9,7 +9,7 @@ namespace otk { -void OBTimerQueueManager::fire() +void OBTimerQueueManager::fire(bool wait) { fd_set rfds; timeval now, tm, *timeout = (timeval *) 0; @@ -19,17 +19,19 @@ void OBTimerQueueManager::fire() FD_ZERO(&rfds); FD_SET(xfd, &rfds); // break on any x events - if (! timerList.empty()) { - const OBTimer* const timer = timerList.top(); - - gettimeofday(&now, 0); - tm = timer->remainingTime(now); - - timeout = &tm; + if (wait) { + if (! timerList.empty()) { + const OBTimer* const timer = timerList.top(); + + gettimeofday(&now, 0); + tm = timer->remainingTime(now); + + timeout = &tm; + } + + select(xfd + 1, &rfds, 0, 0, timeout); } - select(xfd + 1, &rfds, 0, 0, timeout); - // check for timer timeout gettimeofday(&now, 0); -- cgit v1.2.3