aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/server/thread_pool.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpp/server/thread_pool.cc')
-rw-r--r--src/cpp/server/thread_pool.cc5
1 files changed, 3 insertions, 2 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;
}
}