|
template<typename F , typename... Args> |
| Timer (const std::chrono::milliseconds &timeout, F f, Args &&... args) |
| Starts a timer that will expire after timeout and execute action.
|
|
template<typename F , typename... Args> |
| Timer (const std::chrono::milliseconds &timeout, TimerType type, TimerThreadPriority prio, F f, Args &&... args) |
|
| Timer (Timer &&other)=delete |
|
| Timer (const Timer &)=delete |
|
Timer & | operator= (Timer &&other)=delete |
|
Timer & | operator= (const Timer &other)=delete |
|
| ~Timer () |
| The destructor cancels the timer if it's still not expired.
|
|
void | cancel () |
| Cancels the timer.
|
|
|
void | start (const std::chrono::milliseconds &timeout, TimerType type, TimerThreadPriority prio, const std::function< void()> &callback) |
|
void | singleShotTimer (TimerThreadPriority prio, const std::chrono::steady_clock::time_point &deadline) |
|
void | recurringTimer (TimerThreadPriority prio, const std::chrono::milliseconds &interval) |
|
◆ Timer()
template<typename F , typename... Args>
AICommon::Timer::Timer |
( |
const std::chrono::milliseconds & |
timeout, |
|
|
F |
f, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
Starts a timer that will expire after timeout and execute action.
- Parameters
-
The | second parameter is a function to be called on expiry, and third an later are (optional) arguments to it. eg.: auto t1 = Timer(minutes(30), orderBeer, 5, "Fursty Ferret"); auto t2 = Timer(hours(3), leavePub); |
◆ ~Timer()
The destructor cancels the timer if it's still not expired.
- Note
- If the action is executing it will block until it finishes.
◆ cancel()
Cancels the timer.
- Note
- if you call it more than once, subsequent calls will be ignored.
The documentation for this class was generated from the following files:
- AppInfrastructure/Common/include/Timer.h
- AppInfrastructure/Common/source/Timer.cpp