dam4rus commented on a change in pull request #992:
URL: https://github.com/apache/nifi-minifi-cpp/pull/992#discussion_r579225873



##########
File path: libminifi/src/Connection.cpp
##########
@@ -224,11 +216,11 @@ std::shared_ptr<core::FlowFile> 
Connection::poll(std::set<std::shared_ptr<core::
 }
 
 void Connection::drain(bool delete_permanently) {
-  std::lock_guard<std::mutex> lock(mutex_);
+  auto lockedQueue = queue_.lock();

Review comment:
       You mean only lock it before calling empty and unlock after pop_front? 
That's not an equivalent refactor. I don't know how costly the operations are 
after pop-ing the element but locking in a loop can definitely degrade the 
performance.




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


Reply via email to