Kea
1.9.9-git
|
Implementation of the TimerMgr
.
More...
Public Member Functions | |
TimerMgrImpl () | |
Constructor. More... | |
void | cancel (const std::string &timer_name) |
Cancels the execution of the interval timer. More... | |
bool | isTimerRegistered (const std::string &timer_name) |
Checks if the timer with a specified name has been registered. More... | |
void | registerTimer (const std::string &timer_name, const asiolink::IntervalTimer::Callback &callback, const long interval, const asiolink::IntervalTimer::Mode &scheduling_mode) |
Registers new timer in the TimerMgr . More... | |
void | setIOService (const IOServicePtr &io_service) |
Sets IO service to be used by the Timer Manager. More... | |
void | setup (const std::string &timer_name) |
Schedules the execution of the interval timer. More... | |
size_t | timersCount () const |
Returns the number of registered timers. More... | |
void | unregisterTimer (const std::string &timer_name) |
Unregisters specified timer. More... | |
void | unregisterTimers () |
Unregisters all timers. More... | |
Implementation of the TimerMgr
.
Definition at line 75 of file timer_mgr.cc.
isc::dhcp::TimerMgrImpl::TimerMgrImpl | ( | ) |
Constructor.
Definition at line 226 of file timer_mgr.cc.
void isc::dhcp::TimerMgrImpl::cancel | ( | const std::string & | timer_name | ) |
Cancels the execution of the interval timer.
timer_name | Unique timer name. |
BadValue | if the timer hasn't been registered. |
Definition at line 386 of file timer_mgr.cc.
bool isc::dhcp::TimerMgrImpl::isTimerRegistered | ( | const std::string & | timer_name | ) |
Checks if the timer with a specified name has been registered.
timer_name | Name of the timer. |
Definition at line 338 of file timer_mgr.cc.
void isc::dhcp::TimerMgrImpl::registerTimer | ( | const std::string & | timer_name, |
const asiolink::IntervalTimer::Callback & | callback, | ||
const long | interval, | ||
const asiolink::IntervalTimer::Mode & | scheduling_mode | ||
) |
Registers new timer in the TimerMgr
.
timer_name | Unique name for the timer. |
callback | Pointer to the callback function to be invoked when the timer elapses, e.g. function processing expired leases in the DHCP server. |
interval | Timer interval in milliseconds. |
scheduling_mode | Scheduling mode of the timer as described in asiolink::IntervalTimer::Mode . |
BadValue | if the timer name is invalid or duplicate. |
Definition at line 240 of file timer_mgr.cc.
void isc::dhcp::TimerMgrImpl::setIOService | ( | const IOServicePtr & | io_service | ) |
Sets IO service to be used by the Timer Manager.
io_service | Pointer to the new IO service. |
Definition at line 231 of file timer_mgr.cc.
References isc_throw.
void isc::dhcp::TimerMgrImpl::setup | ( | const std::string & | timer_name | ) |
Schedules the execution of the interval timer.
This method schedules the timer, i.e. the callback will be executed after specified interval elapses. The interval has been specified during timer registration. Depending on the mode selected during the timer registration, the callback will be executed once after it has been scheduled or until it is cancelled. Though, in the former case the timer can be re-scheduled in the callback function.
timer_name | Unique timer name. |
BadValue | if the timer hasn't been registered. |
Definition at line 358 of file timer_mgr.cc.
size_t isc::dhcp::TimerMgrImpl::timersCount | ( | ) | const |
Returns the number of registered timers.
Definition at line 348 of file timer_mgr.cc.
void isc::dhcp::TimerMgrImpl::unregisterTimer | ( | const std::string & | timer_name | ) |
Unregisters specified timer.
This method cancels the timer if it is setup and removes the timer from the internal collection of timers.
timer_name | Name of the timer to be unregistered. |
BadValue | if the specified timer hasn't been registered. |
Definition at line 280 of file timer_mgr.cc.
void isc::dhcp::TimerMgrImpl::unregisterTimers | ( | ) |
Unregisters all timers.
This method must be explicitly called prior to termination of the process.
Definition at line 308 of file timer_mgr.cc.