summaryrefslogtreecommitdiff
path: root/otk/timerqueuemanager.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-07 19:24:38 +0000
committerDana Jansens <danakj@orodu.net>2003-01-07 19:24:38 +0000
commita2de94e91e1c0e7775c97745ae11d14e5c5f5659 (patch)
treefd69635008f02d4abad11c8f95fb1baf4db0dda3 /otk/timerqueuemanager.cc
parent6062fe404ce5f2505494132d5454370d696625ca (diff)
in synch mode, chew up 100% cpu, cuz we cant select on the display's fd
Diffstat (limited to 'otk/timerqueuemanager.cc')
-rw-r--r--otk/timerqueuemanager.cc22
1 files changed, 12 insertions, 10 deletions
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);