| 60 | void start() { app_->start(); } |
| 61 | |
| 62 | void stop() { |
| 63 | running_ = false; |
| 64 | blocked_ = true; |
| 65 | condition_.notify_one(); |
| 66 | notify_condition_.notify_one(); |
| 67 | app_->clear_all_handler(); |
| 68 | stop_offer(); |
| 69 | if (std::this_thread::get_id() != offer_thread_.get_id()) { |
| 70 | if (offer_thread_.joinable()) { |
| 71 | offer_thread_.join(); |
| 72 | } |
| 73 | } else { |
| 74 | offer_thread_.detach(); |
| 75 | } |
| 76 | if (std::this_thread::get_id() != notify_thread_.get_id()) { |
| 77 | if (notify_thread_.joinable()) { |
| 78 | notify_thread_.join(); |
| 79 | } |
| 80 | } else { |
| 81 | notify_thread_.detach(); |
| 82 | } |
| 83 | app_->stop(); |
| 84 | } |
| 85 | |
| 86 | void offer() { |
| 87 | std::scoped_lock its_lock(notify_mutex_); |
no test coverage detected