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

Method shutdown

source/executors/worker_thread_executor.cpp:168–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168void worker_thread_executor::shutdown() {
169 const auto abort = m_atomic_abort.exchange(true, std::memory_order_relaxed);
170 if (abort) {
171 return; // shutdown had been called before.
172 }
173
174 {
175 std::unique_lock<std::mutex> lock(m_lock);
176 m_abort = true;
177 }
178
179 m_private_atomic_abort.store(true, std::memory_order_relaxed);
180 m_semaphore.release();
181
182 if (m_thread.joinable()) {
183 m_thread.join();
184 }
185
186 decltype(m_private_queue) private_queue;
187 decltype(m_public_queue) public_queue;
188
189 {
190 std::unique_lock<std::mutex> lock(m_lock);
191 private_queue = std::move(m_private_queue);
192 public_queue = std::move(m_public_queue);
193 }
194
195 private_queue.clear();
196 public_queue.clear();
197}

Callers

nothing calls this directly

Calls 4

releaseMethod · 0.80
joinableMethod · 0.80
joinMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected