| 693 | bool ThreadPool::OwnsThisThread() { return GetCurrentThreadPool() == this; } |
| 694 | |
| 695 | void ThreadPool::LaunchWorkersUnlocked(int threads) { |
| 696 | std::shared_ptr<State> state = sp_state_; |
| 697 | |
| 698 | for (int i = 0; i < threads; i++) { |
| 699 | state_->workers_.emplace_back(); |
| 700 | auto it = --(state_->workers_.end()); |
| 701 | *it = std::thread([this, state, it] { |
| 702 | SetCurrentThreadPool(this); |
| 703 | WorkerLoop(state, it); |
| 704 | }); |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | Status ThreadPool::SpawnReal(TaskHints hints, FnOnce<void()> task, StopToken stop_token, |
| 709 | StopCallback&& stop_callback) { |
nothing calls this directly
no test coverage detected