Repository: thrift Updated Branches: refs/heads/master 5cf9d7744 -> 2fadc8d5c
THRIFT-2872 Fix dead lock when all tasks are expired If manager_->removeExpiredTasks() cleared all tasks, we didn't notify those who are waiting for maxMonitor_. This patch fixes it. Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/2fadc8d5 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/2fadc8d5 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/2fadc8d5 Branch: refs/heads/master Commit: 2fadc8d5cace1854cdd94483f7f231080bbd2d64 Parents: 5cf9d77 Author: Qiao Mu <[email protected]> Authored: Wed Dec 3 10:48:36 2014 +0800 Committer: Roger Meier <[email protected]> Committed: Fri Jul 3 20:42:43 2015 +0200 ---------------------------------------------------------------------- lib/cpp/src/thrift/concurrency/ThreadManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/2fadc8d5/lib/cpp/src/thrift/concurrency/ThreadManager.cpp ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp index 0e7ccd8..a2b44d4 100644 --- a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp +++ b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp @@ -271,13 +271,13 @@ public: if (task->state_ == ThreadManager::Task::WAITING) { task->state_ = ThreadManager::Task::EXECUTING; } + } - /* If we have a pending task max and we just dropped below it, wakeup any - thread that might be blocked on add. */ - if (manager_->pendingTaskCountMax_ != 0 - && manager_->tasks_.size() <= manager_->pendingTaskCountMax_ - 1) { + /* If we have a pending task max and we just dropped below it, wakeup any + thread that might be blocked on add. */ + if (manager_->pendingTaskCountMax_ != 0 + && manager_->tasks_.size() <= manager_->pendingTaskCountMax_ - 1) { manager_->maxMonitor_.notify(); - } } } else { idle_ = true;
