diff --git a/src/core/lib/iomgr/executor/threadpool.cc b/src/core/lib/iomgr/executor/threadpool.cc index f0df1bd18eb..29eb0a67cf8 100644 --- a/src/core/lib/iomgr/executor/threadpool.cc +++ b/src/core/lib/iomgr/executor/threadpool.cc @@ -72,9 +72,9 @@ size_t ThreadPool::DefaultStackSize() { #endif } -bool ThreadPool::HasBeenShutDown() { +void ThreadPool::AssertHasBeenShutDown() { // For debug checking purpose, using RELAXED order is sufficient. - return shut_down_.Load(MemoryOrder::RELAXED); + GPR_DEBUG_ASSERT(!shut_down_.Load(MemoryOrder::RELAXED)); } ThreadPool::ThreadPool(int num_threads) : num_threads_(num_threads) { @@ -122,7 +122,7 @@ ThreadPool::~ThreadPool() { } void ThreadPool::Add(grpc_experimental_completion_queue_functor* closure) { - GPR_DEBUG_ASSERT(!HasBeenShutDown()); + AssertHasBeenShutDown(); queue_->Put(static_cast(closure)); } diff --git a/src/core/lib/iomgr/executor/threadpool.h b/src/core/lib/iomgr/executor/threadpool.h index 78f61a3139c..16277838fb0 100644 --- a/src/core/lib/iomgr/executor/threadpool.h +++ b/src/core/lib/iomgr/executor/threadpool.h @@ -145,7 +145,7 @@ class ThreadPool : public ThreadPoolInterface { // platforms is 64K. size_t DefaultStackSize(); // Internal Use Only for debug checking. - bool HasBeenShutDown(); + void AssertHasBeenShutDown(); }; } // namespace grpc_core