From c65dc30fc27c714331efd6485d7d913c7a6f6af4 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Tue, 19 Jan 2010 20:20:13 +0100 Subject: improved documentation of the code --- src/FbTk/Timer.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 773ef07..44ea69a 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc @@ -45,8 +45,6 @@ #include #endif -#include - namespace FbTk { Timer::TimerList Timer::m_timerlist; @@ -124,7 +122,9 @@ void Timer::updateTimers(int fd) { FD_SET(fd, &rfds); bool overdue = false; - + + // see, if the first timer in the + // list is overdue if (!m_timerlist.empty()) { gettimeofday(&now, 0); @@ -155,8 +155,11 @@ void Timer::updateTimers(int fd) { timeout = &tm; } + // if not overdue, wait for the next xevent via the blocking + // select(), so OS sends fluxbox to sleep. the select() will + // time out when the next timer has to be handled if (!overdue && select(fd + 1, &rfds, 0, 0, timeout) != 0) - // didn't time out! x events pending + // didn't time out! x events are pending return; TimerList::iterator it; @@ -168,7 +171,7 @@ void Timer::updateTimers(int fd) { // so we have to adjust the start_time static time_t last_time = 0; if (now.tv_sec < last_time) { - + time_t delta = last_time - now.tv_sec; for (it = m_timerlist.begin(); it != m_timerlist.end(); it++) { -- cgit v0.11.2