Class Timer¶
Defined in File timer.h
Inheritance Relationships¶
Base Type¶
private Runnable
Class Documentation¶
-
class Timer : private Runnable¶
Support for delayed or periodic callback execution.
Public Functions
-
Timer(std::string threadName, ThreadPriority priority)¶
Create a new timer queue
- Parameters
threadName – name for the timer thread.
priority – thread priority
-
virtual ~Timer()¶
-
void close()¶
Prevent new callbacks from being scheduled, and cancel pending callbacks.
-
void scheduleAfterDelay(TimerCallbackPtr const &timerCallback, double delay)¶
schedule a callback after a delay.
- Parameters
timerCallback – the timerCallback instance.
delay – number of seconds before calling callback.
-
void schedulePeriodic(TimerCallbackPtr const &timerCallback, double delay, double period)¶
schedule a periodic callback.`
- Parameters
timerCallback – the timerCallback instance.
delay – number of seconds before first callback.
period – time in seconds between each callback.
-
bool cancel(TimerCallbackPtr const &timerCallback)¶
cancel a callback.
- Parameters
timerCallback – the timerCallback to cancel.
- Returns
true if the timer was queued, and now is cancelled
-
bool isScheduled(TimerCallbackPtr const &timerCallback) const¶
Is the callback scheduled to be called?
- Parameters
timerCallback – the timerCallback.
- Returns
(false,true) if (not, is) scheduled.
-
void dump(std::ostream &o) const¶
show the elements in the timer queue.
- Parameters
o – The output stream for the output
-
Timer(std::string threadName, ThreadPriority priority)¶