aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-06-01 14:32:38 -0700
committerGravatar Yang Gao <yangg@google.com>2015-06-01 14:32:38 -0700
commit69fe0759bee3579d743d2e71f36504366ee0d275 (patch)
treec606530611fb27e57ebd9786c4c89c814dce9783 /src/cpp
parent7b49a7737c3d323686ebdac5640672241eae89cb (diff)
Various minor fixes
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/server/thread_pool.cc5
-rw-r--r--src/cpp/server/thread_pool.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc
index e8d0e89ed2..118cabcb61 100644
--- a/src/cpp/server/thread_pool.cc
+++ b/src/cpp/server/thread_pool.cc
@@ -60,7 +60,7 @@ void ThreadPool::ThreadFunc() {
ThreadPool::ThreadPool(int num_threads) : shutdown_(false) {
for (int i = 0; i < num_threads; i++) {
- threads_.push_back(grpc::thread(&ThreadPool::ThreadFunc, this));
+ threads_.push_back(new grpc::thread(&ThreadPool::ThreadFunc, this));
}
}
@@ -71,7 +71,8 @@ ThreadPool::~ThreadPool() {
cv_.notify_all();
}
for (auto t = threads_.begin(); t != threads_.end(); t++) {
- t->join();
+ (*t)->join();
+ delete *t;
}
}
diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h
index 0f24d6e9b3..26f25611b5 100644
--- a/src/cpp/server/thread_pool.h
+++ b/src/cpp/server/thread_pool.h
@@ -57,7 +57,7 @@ class ThreadPool GRPC_FINAL : public ThreadPoolInterface {
grpc::condition_variable cv_;
bool shutdown_;
std::queue<std::function<void()>> callbacks_;
- std::vector<grpc::thread> threads_;
+ std::vector<grpc::thread*> threads_;
void ThreadFunc();
};