Scheduler that manages timer execution.
More...
#include <TimerScheduler.hpp>
Scheduler that manages timer execution.
Definition at line 114 of file TimerScheduler.hpp.
◆ clock
◆ TimerScheduler() [1/3]
time_shield::TimerScheduler::TimerScheduler |
( |
| ) |
|
|
inlinedefault |
◆ ~TimerScheduler()
time_shield::TimerScheduler::~TimerScheduler |
( |
| ) |
|
|
inline |
◆ TimerScheduler() [2/3]
time_shield::TimerScheduler::TimerScheduler |
( |
const TimerScheduler & | | ) |
|
|
delete |
◆ TimerScheduler() [3/3]
◆ active_timer_count_for_testing()
std::size_t time_shield::TimerScheduler::active_timer_count_for_testing |
( |
| ) |
|
|
inline |
Returns number of timer states that are still alive.
Method is intended for tests to verify resource cleanup.
Definition at line 341 of file TimerScheduler.hpp.
◆ collect_due_timers_locked()
void time_shield::TimerScheduler::collect_due_timers_locked |
( |
std::vector< detail::DueTimer > & | due, |
|
|
clock::time_point | now ) |
|
inlineprivate |
◆ create_timer_state()
◆ destroy_timer_state()
void time_shield::TimerScheduler::destroy_timer_state |
( |
const timer_state_ptr & | state | ) |
|
|
inlineprivate |
◆ execute_due_timers()
void time_shield::TimerScheduler::execute_due_timers |
( |
std::vector< detail::DueTimer > & | due | ) |
|
|
inlineprivate |
◆ finalize_timer()
void time_shield::TimerScheduler::finalize_timer |
( |
const detail::DueTimer & | due_timer | ) |
|
|
inlineprivate |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ process()
void time_shield::TimerScheduler::process |
( |
| ) |
|
|
inline |
Processes all timers that are ready to fire at the moment of the call.
The method is non-blocking: it does not wait for future timers. It must not be called while the worker thread started by run() is active.
Definition at line 326 of file TimerScheduler.hpp.
◆ run()
void time_shield::TimerScheduler::run |
( |
| ) |
|
|
inline |
Starts a dedicated worker thread that processes timers.
This method is non-blocking. It spawns a background thread that waits for timers to fire and executes their callbacks. While the worker thread is active, manual processing via process() or update() must not be used.
Definition at line 266 of file TimerScheduler.hpp.
◆ start_timer()
void time_shield::TimerScheduler::start_timer |
( |
const timer_state_ptr & | state, |
|
|
clock::time_point | when ) |
|
inlineprivate |
◆ stop()
void time_shield::TimerScheduler::stop |
( |
| ) |
|
|
inline |
Requests the worker thread to stop and waits for it to exit.
Definition at line 276 of file TimerScheduler.hpp.
◆ stop_timer()
void time_shield::TimerScheduler::stop_timer |
( |
const timer_state_ptr & | state | ) |
|
|
inlineprivate |
◆ update()
void time_shield::TimerScheduler::update |
( |
| ) |
|
|
inline |
◆ worker_loop()
void time_shield::TimerScheduler::worker_loop |
( |
| ) |
|
|
inlineprivate |
◆ Timer
◆ m_cv
std::condition_variable time_shield::TimerScheduler::m_cv |
|
private |
◆ m_is_worker_running
bool time_shield::TimerScheduler::m_is_worker_running {false} |
|
private |
◆ m_mutex
std::mutex time_shield::TimerScheduler::m_mutex |
|
private |
◆ m_next_id
std::size_t time_shield::TimerScheduler::m_next_id {1} |
|
private |
◆ m_queue
◆ m_stop_requested
bool time_shield::TimerScheduler::m_stop_requested {false} |
|
private |
◆ m_thread
std::thread time_shield::TimerScheduler::m_thread |
|
private |
◆ m_timers
std::unordered_map<std::size_t, std::weak_ptr<detail::TimerState> > time_shield::TimerScheduler::m_timers |
|
private |
The documentation for this class was generated from the following file: