arpadboda 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_r396714686
 
 

 ##########
 File path: libminifi/include/utils/ThreadPool.h
 ##########
 @@ -303,8 +303,9 @@ class ThreadPool {
    * Drain will notify tasks to stop following notification
    */
   void drain() {
+    worker_queue_.stop();
     while (current_workers_ > 0) {
-      tasks_available_.notify_one();
+      std::this_thread::sleep_for(std::chrono::milliseconds(1));
 
 Review comment:
   @bakaid is right. 
   Stopping the queue wakes up all the worker threads actually doing nothing 
(waiting for work), but there can be worker threads doing some useful work 
(ontrigger calls, c2 heartbeats, whatever). These should end in a timely manner 
and stopping the queue guarantees that they don't pick up new tasks, but I 
found no better option to wait for that. 

----------------------------------------------------------------
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

Reply via email to