*/
//
-// PollingScheduler.cxx
+// PollingScheduler class implementation.
//
#include <x0vncserver/PollingScheduler.h>
return (m_interval - elapsed);
}
+bool PollingScheduler::goodTimeToPoll() const
+{
+ return (millisRemaining() == 0);
+}
*/
//
-// 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__
// 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;
server.checkTimeouts();
- if (sched.millisRemaining() <= 0) {
+ if (sched.goodTimeToPoll()) {
adjustPollingCycle(&dynPollingCycle, &cpumon);
sched.setInterval(dynPollingCycle);
sched.newPass();