23 #include <boost/asio/deadline_timer.hpp> 24 #include <boost/chrono.hpp> 26 #include <condition_variable> 45 void Start(
const boost::asio::deadline_timer::duration_type & t, std::function<
void()> handler)
47 std::unique_lock<std::mutex> lock(
Mutex);
54 Timer.expires_from_now(t);
55 Timer.async_wait([
this, handler, t](
const boost::system::error_code & error)
63 std::unique_lock<std::mutex> lock(
Mutex);
72 return static_cast<bool>(
Stopped);
77 void OnTimer(
const boost::system::error_code & error, std::function<
void()> handler, boost::asio::deadline_timer::duration_type t)
79 std::unique_lock<std::mutex> lock(
Mutex);
91 Timer.expires_from_now(t);
92 Timer.async_wait([
this, handler, t](
const boost::system::error_code & error)
std::condition_variable StopEvent
boost::asio::deadline_timer Timer
OPC UA Address space part. GNU LGPL.
void OnTimer(const boost::system::error_code &error, std::function< void()> handler, boost::asio::deadline_timer::duration_type t)
std::atomic< bool > Stopped
PeriodicTimer(boost::asio::io_service &io)
std::atomic< bool > IsCanceled
void Start(const boost::asio::deadline_timer::duration_type &t, std::function< void()> handler)