34 const std::chrono::milliseconds interval;
36 bool thread_must_stop;
39 std::condition_variable condition;
47 while (!thread_must_stop)
49 condition.wait_for(lock, interval);
54 client.locked_ping(lock);
66 thread_must_stop(false),
73 if (stopped && interval.count() > 0)
75 thread_must_stop =
false;
76 thread = std::thread([
this](){keep_alive();});
87 thread_must_stop =
true;
89 condition.notify_one();
90 if (thread.joinable())
99 try {
stop();}
catch (...) {}