215 std::unique_ptr<struct WheelTimerImpl> impl_;
void start()
Starts the internal background thread and begins advancing the wheel.
bool is_running() const
Returns true if the wheel is currently running (started and not stopped).
Key add(uint32_t timeout_ms, Callback &&callback, uint32_t repeat_ms=0)
Adds a new timer to the wheel.
void stop()
Stops the wheel and joins the background thread.
~WheelTimer()
Destructor. Calls stop() if the wheel is still running.
WheelTimer(uint32_t slots, uint32_t interval_ms)
Constructs the wheel timer.
void wakeup()
Wakes the internal worker thread if it is sleeping between ticks.
uint32_t get_remaining_time(Key key) const
Returns the estimated remaining time for a timer.
void resume()
Resumes a paused wheel.
std::function< void(Key)> Callback
Callback invoked when a timer expires.
Definition wheel_timer.h:102
void pause()
Temporarily suspends the wheel without terminating the background thread.
bool remove(Key key)
Removes a timer before it fires.
void set_catchup_limit(uint32_t max_slots_to_catch_up)
Sets the maximum number of missed slots processed in a single tick.
int64_t Key
Opaque handle returned by add() and used to remove() a timer.
Definition wheel_timer.h:94
Platform-independent macro definitions for the VLink library.
#define VLINK_EXPORT
Definition macros.h:85
#define VLINK_DISALLOW_COPY_AND_ASSIGN(classname)
Deletes the copy constructor and copy-assignment operator of classname.
Definition macros.h:184