| 521 | } |
| 522 | |
| 523 | void ThreadPool::WaitForIdle() { |
| 524 | std::unique_lock<std::mutex> lk(state_->mutex_); |
| 525 | state_->cv_idle_.wait(lk, [this] { return state_->tasks_queued_or_running_ == 0; }); |
| 526 | } |
| 527 | |
| 528 | ThreadPool::ThreadPool() |
| 529 | : sp_state_(std::make_shared<ThreadPool::State>()), |