MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / shutdown

Method shutdown

source/timers/timer_queue.cpp:234–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234void 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
254concurrencpp::details::thread timer_queue::ensure_worker_thread(std::unique_lock<std::mutex>& lock) {
255 assert(lock.owns_lock());

Callers 2

shutdown_allMethod · 0.45
~runtimeMethod · 0.45

Calls 5

joinableMethod · 0.80
unlockMethod · 0.80
notify_allMethod · 0.80
joinMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected