Skip to content

Commit 4f59690

Browse files
committed
clean unused codes
test=develop
1 parent 784a19e commit 4f59690

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

paddle/fluid/framework/threadpool.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ void ThreadPool::Init() {
5252
}
5353
}
5454

55-
ThreadPool::ThreadPool(int num_threads)
56-
: total_threads_(num_threads), idle_threads_(num_threads), running_(true) {
55+
ThreadPool::ThreadPool(int num_threads) : running_(true) {
5756
threads_.resize(num_threads);
5857
for (auto& thread : threads_) {
5958
// TODO(Yancey1989): binding the thread on the specify CPU number
@@ -82,16 +81,13 @@ void ThreadPool::TaskLoop() {
8281
scheduled_.wait(
8382
lock, [this] { return !this->tasks_.empty() || !this->running_; });
8483

85-
std::lock_guard<std::mutex> l(mutex_);
8684
if (!running_ || tasks_.empty()) {
8785
return;
8886
}
8987

9088
// pop a task from the task queue
9189
auto task = std::move(tasks_.front());
9290
tasks_.pop();
93-
94-
--idle_threads_;
9591
lock.unlock();
9692

9793
// run the task

paddle/fluid/framework/threadpool.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,11 @@ class ThreadPool {
107107
static std::once_flag init_flag_;
108108

109109
std::vector<std::unique_ptr<std::thread>> threads_;
110-
const size_t total_threads_;
111-
size_t idle_threads_;
112110

113111
std::queue<Task> tasks_;
114112
std::mutex mutex_;
115113
bool running_;
116114
std::condition_variable scheduled_;
117-
std::condition_variable completed_;
118115
};
119116

120117
class ThreadPoolIO : ThreadPool {

0 commit comments

Comments
 (0)