-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifdef HAVE_CONFIG_H
# include "../config.h"
namespace otk {
-void OBTimerQueueManager::fire()
+void OBTimerQueueManager::fire(bool wait)
{
fd_set rfds;
timeval now, tm, *timeout = (timeval *) 0;
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->timeRemaining(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);
timerList.pop();
- timer->fireTimeout();
- if (timer->isRecurring())
+ timer->fire();
+ if (timer->recurring())
timer->start();
}
}