| 80 | return true; |
| 81 | } |
| 82 | bool stop() |
| 83 | { |
| 84 | std::lock_guard<std::mutex> lock(control_mutex_); |
| 85 | if (!is_running_) |
| 86 | return false; |
| 87 | stop_mutex_.unlock(); |
| 88 | if (thread_.joinable()) { |
| 89 | thread_.join(); |
| 90 | thread_ = std::thread(); |
| 91 | } |
| 92 | is_running_ = false; |
| 93 | return true; |
| 94 | } |
| 95 | ~ticker() |
| 96 | { |
| 97 | stop(); |