szaszm commented on a change in pull request #746: MINIFICPP-1185 - Remove
moodycamel::concurrentqueue from threadpool
URL: https://github.com/apache/nifi-minifi-cpp/pull/746#discussion_r399644887
##########
File path: libminifi/src/utils/ThreadPool.cpp
##########
@@ -64,8 +64,10 @@ void ThreadPool<T>::run_tasks(std::shared_ptr<WorkerThread>
thread) {
}
}
} else {
- std::unique_lock<std::mutex> lock(worker_queue_mutex_);
- tasks_available_.wait(lock);
+ // This means that the threadpool is running, but the ConcurrentQueue is
stopped -> shouldn't happen
+ if (running_.load()) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
Review comment:
If it shouldn't happen and we're handling it, then we should log the event
and consider throw/abort and generating a core dump for debugging.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services