Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/980#discussion_r60590542
  
    --- Diff: lib/cpp/src/thrift/concurrency/ThreadManager.cpp ---
    @@ -421,7 +416,7 @@ void ThreadManager::Impl::removeWorker(size_t value) {
       {
         Synchronized s(workerMonitor_);
     
    -    while (workerCount_ != workerMaxCount_) {
    +    while (workerCount_ > goalCount) {
    --- End diff --
    
    This routine blocks until there are fewer actual workers than the number of 
workers when it was called less the value passed in.  On a busy system where 
workers are being added this means it might be in here for a while.  I did not 
change this behavior; simply I ensured that the effects of multiple threads 
calling removeWorker() at the same time don't clobber each-other's desired goal 
of how many to remove.
    
    It would be better to have two calls; one to trim the maximum number of 
workers but it doesn't block; another being a barrier you can use to get to 
that number.  Callers may want to trim without blocking, for example.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to