Low-Precision Timer Class.
More...
#include <Timer.h>
|
| | ~Timer () noexcept |
| | Timer destructor.
|
| |
| TimerTask::Ptr | delay (const std::function< void()> &callback, int64_t relative_timestamp, bool is_repeat=false) noexcept |
| |
| void | shutdown () noexcept |
| | Shutdown the timer and terminate the timer thread.
|
| |
| | Timer ()=default |
| | Private constructor.
|
| |
| void | loop () noexcept |
| |
Low-Precision Timer Class.
◆ Ptr
◆ ~Timer()
◆ Timer()
◆ cancelCallback()
| void Timer::cancelCallback |
( |
const std::weak_ptr< Timer > & | weak_timer, |
|
|
const std::weak_ptr< TimerTask > & | weak_task ) |
|
staticnoexcept |
◆ create()
Initialize a timer
- Parameters
-
| number | Number of slots in the timer wheel |
References MAKE_SHARED_PRIVATE.
◆ delay()
| TimerTask::Ptr Timer::delay |
( |
const std::function< void()> & | callback, |
|
|
int64_t | relative_timestamp, |
|
|
bool | is_repeat = false ) |
|
noexcept |
Set a delayed task
- Parameters
-
| callback | Callback function |
| relative_timestamp | Delay duration |
| is_repeat | Whether to repeat |
- Returns
- Task handle
References cancelCallback().
◆ loop()
◆ shutdown()
◆ currentTimestamp
| std::atomic<int64_t> sese::Timer::currentTimestamp = 0 |
◆ isShutdown
| std::atomic_bool sese::Timer::isShutdown = false |
◆ mutex
| std::mutex sese::Timer::mutex {} |
◆ number
| size_t sese::Timer::number = 0 |
◆ thread
◆ timerTasks
The documentation for this class was generated from the following files: