MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / shutdown

Method shutdown

libminifi/src/utils/ThreadPool.cpp:203–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201
202template<typename T>
203void ThreadPool<T>::shutdown() {
204 if (running_.load()) {
205 std::lock_guard<std::recursive_mutex> lock(manager_mutex_);
206 running_.store(false);
207
208 drain();
209
210 task_status_.clear();
211 if (manager_thread_.joinable()) {
212 manager_thread_.join();
213 }
214
215 delayed_task_available_.notify_all();
216 if (delayed_scheduler_thread_.joinable()) {
217 delayed_scheduler_thread_.join();
218 }
219
220 for (const auto &thread : thread_queue_) {
221 if (thread->thread_.joinable())
222 thread->thread_.join();
223 }
224
225 thread_queue_.clear();
226 current_workers_ = 0;
227 while (!delayed_worker_queue_.empty()) {
228 delayed_worker_queue_.pop();
229 }
230
231 worker_queue_.clear();
232 }
233}
234
235template class utils::ThreadPool<utils::TaskRescheduleInfo>;
236template class utils::ThreadPool<int>;

Callers 5

~InstanceMethod · 0.80
stopMethod · 0.80
loadMethod · 0.80
stopMethod · 0.80
notifyStopMethod · 0.80

Calls 5

loadMethod · 0.45
clearMethod · 0.45
joinMethod · 0.45
emptyMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected