| 232 | } |
| 233 | |
| 234 | void timer_queue::shutdown() { |
| 235 | const auto state_before = m_atomic_abort.exchange(true, std::memory_order_relaxed); |
| 236 | if (state_before) { |
| 237 | return; // timer_queue has been shut down already. |
| 238 | } |
| 239 | |
| 240 | std::unique_lock<std::mutex> lock(m_lock); |
| 241 | m_abort = true; |
| 242 | |
| 243 | if (!m_worker.joinable()) { |
| 244 | return; // nothing to shut down |
| 245 | } |
| 246 | |
| 247 | m_request_queue.clear(); |
| 248 | lock.unlock(); |
| 249 | |
| 250 | m_condition.notify_all(); |
| 251 | m_worker.join(); |
| 252 | } |
| 253 | |
| 254 | concurrencpp::details::thread timer_queue::ensure_worker_thread(std::unique_lock<std::mutex>& lock) { |
| 255 | assert(lock.owns_lock()); |
no test coverage detected