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_r400051711
 
 

 ##########
 File path: libminifi/include/utils/MinifiConcurrentQueue.h
 ##########
 @@ -119,10 +133,22 @@ class ConditionConcurrentQueue : private 
ConcurrentQueue<T> {
     }
   }
   
-  bool dequeue(T& out) {
+  bool dequeueWait(T& out) {
+    std::unique_lock<std::mutex> lck(this->mtx_);
+    cv_.wait(lck, [this, &lck]{ return !running_ || !this->emptyImpl(lck); }); 
 // Only wake up if there is something to return or stopped 
+    return running_ && ConcurrentQueue<T>::tryDequeueImpl(lck, out);
+  }
+
+  template< class Rep, class Period >
+  bool dequeueWaitFor(T& out, const std::chrono::duration<Rep, Period>& time) {
 
 Review comment:
   I like that you used a template here, not just a concrete duration type like 
`milliseconds`, which is more common in the code base.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to