arpadboda commented on a change in pull request #735: WIP: MINIFICPP-1158 - 
Event driven processors can starve each other
URL: https://github.com/apache/nifi-minifi-cpp/pull/735#discussion_r382153078
 
 

 ##########
 File path: libminifi/src/core/Processor.cpp
 ##########
 @@ -268,6 +268,7 @@ void Processor::onTrigger(const 
std::shared_ptr<ProcessContext> &context, const
 
 bool Processor::isWorkAvailable() {
   // We have work if any incoming connection has work
+  std::lock_guard<std::mutex> lock(mutex_);
 
 Review comment:
   > My guess would be that we need to use `Connectable::work_available_mutex_` 
instead of `Processor::mutex_`.
   > 
   > I find it a very bad design decision to expose threading and signaling 
primitives in `Connectable`. `isWorkAvailable()` should be a source object (of 
"work") that can be checked for readiness and waited for. That would break an 
important API, though, so just leaving it here.
   
   In theory you are most probably right, but if you look at that file, all the 
other functions that touch incoming and outgoing connections lock this mutex. 
   I'm fine with a follow-up ticket to clean this up, but this PR wasn't meant 
to do 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