class Poco::Util::TimerTask
Overview
A task that can be scheduled for one-time or repeated execution by a Timer. Moreā¦
#include <TimerTask.h> class TimerTask: public Poco::RefCountedObject, public Poco::Runnable { public: // typedefs typedef Poco::AutoPtr<TimerTask> Ptr; // methods void cancel(); bool isCancelled() const; Poco::Timestamp lastExecution() const; }; // direct descendants template <class C> class TimerTaskAdapter;
Inherited Members
public: // methods void duplicate() const; void release() const; int referenceCount() const; virtual void run() = 0;
Detailed Documentation
A task that can be scheduled for one-time or repeated execution by a Timer.
This is an abstract class. Subclasses must override the run() member function to implement the actual task logic.
Methods
void cancel()
Cancels the execution of the timer.
If the task has been scheduled for one-time execution and has not yet run, or has not yet been scheduled, it will never run. If the task has been scheduled for repeated execution, it will never run again. If the task is running when this call occurs, the task will run to completion, but will never run again.
Warning: A TimerTask that has been cancelled must not be scheduled again. An attempt to do so results in a Poco::Util::IllegalStateException being thrown.
bool isCancelled() const
Returns true iff the TimerTask has been cancelled by a call to cancel().
Poco::Timestamp lastExecution() const
Returns the time of the last execution of the timer task.
Returns 0 if the timer has never been executed.