diff options
author | Constantin Kaplinsky <const@tightvnc.com> | 2006-02-16 16:44:50 +0000 |
---|---|---|
committer | Constantin Kaplinsky <const@tightvnc.com> | 2006-02-16 16:44:50 +0000 |
commit | e47123eea2741a20104b70497fa47b576a0e5aff (patch) | |
tree | d505ad29b83f77450a16816bbe78b386dba3b247 /x0vncserver | |
parent | 0cbad330c59fc8a8f23cb63e56e1ecbb71b61b82 (diff) | |
download | tigervnc-e47123eea2741a20104b70497fa47b576a0e5aff.tar.gz tigervnc-e47123eea2741a20104b70497fa47b576a0e5aff.zip |
Improved the interface of the PollingScheduler class, added some
documentation in comments.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@494 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'x0vncserver')
-rw-r--r-- | x0vncserver/PollingScheduler.cxx | 6 | ||||
-rw-r--r-- | x0vncserver/PollingScheduler.h | 8 | ||||
-rw-r--r-- | x0vncserver/x0vncserver.cxx | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/x0vncserver/PollingScheduler.cxx b/x0vncserver/PollingScheduler.cxx index 2d284916..ee315967 100644 --- a/x0vncserver/PollingScheduler.cxx +++ b/x0vncserver/PollingScheduler.cxx @@ -17,7 +17,7 @@ */ // -// PollingScheduler.cxx +// PollingScheduler class implementation. // #include <x0vncserver/PollingScheduler.h> @@ -58,3 +58,7 @@ int PollingScheduler::millisRemaining() const return (m_interval - elapsed); } +bool PollingScheduler::goodTimeToPoll() const +{ + return (millisRemaining() == 0); +} diff --git a/x0vncserver/PollingScheduler.h b/x0vncserver/PollingScheduler.h index 777a6650..ba7b27dd 100644 --- a/x0vncserver/PollingScheduler.h +++ b/x0vncserver/PollingScheduler.h @@ -17,7 +17,10 @@ */ // -// PollingScheduler.h +// PollingScheduler class. It is used for deciding when to start new +// polling pass, and how much time it is ok to wait before starting. +// PollingScheduler is provided a desired polling interval and watches +// for actual intervals between past polling cycles. // #ifndef __POLLINGSCHEDULER_H__ @@ -43,6 +46,9 @@ public: // This function estimates time remaining before new polling pass. int millisRemaining() const; + // This function tells if it's ok to start polling pass right now. + bool goodTimeToPoll() const; + protected: bool initialState; diff --git a/x0vncserver/x0vncserver.cxx b/x0vncserver/x0vncserver.cxx index 27c130a4..d179d943 100644 --- a/x0vncserver/x0vncserver.cxx +++ b/x0vncserver/x0vncserver.cxx @@ -485,7 +485,7 @@ int main(int argc, char** argv) server.checkTimeouts(); - if (sched.millisRemaining() <= 0) { + if (sched.goodTimeToPoll()) { adjustPollingCycle(&dynPollingCycle, &cpumon); sched.setInterval(dynPollingCycle); sched.newPass(); |