atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Public Types | Public Member Functions | List of all members
atscppapi::AsyncTimer Class Reference

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"

Inheritance diagram for atscppapi::AsyncTimer:
atscppapi::AsyncProvider

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

AsyncTimer::AsyncTimer ( Type  type,
int  period_in_ms,
int  initial_period_in_ms = 0 
)

Constructor.

Parameters
typeA one-off timer fires only once and a periodic timer fires periodically.
period_in_msThe receiver will receive an event every this many milliseconds.
initial_period_in_msThe 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.

Member Function Documentation

void AsyncTimer::run ( shared_ptr< AsyncDispatchControllerBase >  dispatch_controller)
virtual

Starts the timer.

Implements atscppapi::AsyncProvider.


The documentation for this class was generated from the following files: