From 69fe0759bee3579d743d2e71f36504366ee0d275 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 1 Jun 2015 14:32:38 -0700 Subject: Various minor fixes --- src/cpp/server/thread_pool.cc | 5 +++-- src/cpp/server/thread_pool.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/cpp') 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> callbacks_; - std::vector threads_; + std::vector threads_; void ThreadFunc(); }; -- cgit v1.2.3