atscppapi
1.0.9
C++ wrapper for Apache Traffic Server API
|
This class provides an implementation of AsyncProvider that acts as a timer. It sends events at the set frequency. Calling the destructor will stop the events. A one-off timer just sends one event. Calling the destructor before this event will cancel the timer. More...
#include "AsyncTimer.h"
Public Types | |
enum | Type { TYPE_ONE_OFF = 0, TYPE_PERIODIC } |
Public Member Functions | |
AsyncTimer (Type type, int period_in_ms, int initial_period_in_ms=0) | |
void | run (shared_ptr< AsyncDispatchControllerBase > dispatch_controller) |
This class provides an implementation of AsyncProvider that acts as a timer. It sends events at the set frequency. Calling the destructor will stop the events. A one-off timer just sends one event. Calling the destructor before this event will cancel the timer.
For either type, user must delete the timer.
See example async_timer for sample usage.
AsyncTimer::AsyncTimer | ( | Type | type, |
int | period_in_ms, | ||
int | initial_period_in_ms = 0 |
||
) |
Constructor.
type | A one-off timer fires only once and a periodic timer fires periodically. |
period_in_ms | The receiver will receive an event every this many milliseconds. |
initial_period_in_ms | The first event will arrive after this many milliseconds. Subsequent events will have "regular" cadence. This is useful if the timer is set for a long period of time (1hr etc.), but an initial event is required. Value of 0 (default) indicates no initial event is desired. |
|
virtual |
Starts the timer.
Implements atscppapi::AsyncProvider.