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