Kea 2.7.5
|
Implementation of the TimerMgr
.
More...
Public Member Functions | |
TimerMgrImpl () | |
Constructor. | |
void | cancel (const std::string &timer_name) |
Cancels the execution of the interval timer. | |
bool | isTimerRegistered (const std::string &timer_name) |
Checks if the timer with a specified name has been registered. | |
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 . | |
void | setIOService (const IOServicePtr &io_service) |
Sets IO service to be used by the Timer Manager. | |
void | setup (const std::string &timer_name) |
Schedules the execution of the interval timer. | |
size_t | timersCount () const |
Returns the number of registered timers. | |
void | unregisterTimer (const std::string &timer_name) |
Unregisters specified timer. | |
void | unregisterTimers () |
Unregisters all timers. | |
Implementation of the TimerMgr
.
Definition at line 83 of file timer_mgr.cc.
isc::dhcp::TimerMgrImpl::TimerMgrImpl | ( | ) |
Constructor.
Definition at line 232 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 391 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().
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 343 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().
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 246 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().
void isc::dhcp::TimerMgrImpl::setIOService | ( | const IOServicePtr & | io_service | ) |
Sets IO service to be used by the Timer Manager.
io_service | Pointer to the IO service. |
Definition at line 237 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 363 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().
size_t isc::dhcp::TimerMgrImpl::timersCount | ( | ) | const |
Returns the number of registered timers.
Definition at line 353 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().
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 286 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().
void isc::dhcp::TimerMgrImpl::unregisterTimers | ( | ) |
Unregisters all timers.
This method must be explicitly called prior to termination of the process.
Definition at line 314 of file timer_mgr.cc.
References isc::util::MultiThreadingMgr::instance().