| 2182 | } |
| 2183 | |
| 2184 | void application_impl::set_watchdog_handler(const watchdog_handler_t& _handler, std::chrono::seconds _interval) { |
| 2185 | if (_handler && std::chrono::seconds::zero() != _interval) { |
| 2186 | std::scoped_lock its_lock{watchdog_timer_mutex_}; |
| 2187 | watchdog_handler_ = _handler; |
| 2188 | watchdog_interval_ = _interval; |
| 2189 | watchdog_timer_.expires_after(_interval); |
| 2190 | watchdog_timer_.async_wait(std::bind(&application_impl::watchdog_cbk, this, std::placeholders::_1)); |
| 2191 | } else { |
| 2192 | std::scoped_lock its_lock{watchdog_timer_mutex_}; |
| 2193 | watchdog_timer_.cancel(); |
| 2194 | watchdog_handler_ = nullptr; |
| 2195 | watchdog_interval_ = std::chrono::seconds::zero(); |
| 2196 | } |
| 2197 | } |
| 2198 | |
| 2199 | void application_impl::register_async_subscription_handler(service_t _service, instance_t _instance, eventgroup_t _eventgroup, |
| 2200 | const async_subscription_handler_t& _handler) { |