MCPcopy Create free account
hub / github.com/apache/arrow / LaunchWorkersUnlocked

Method LaunchWorkersUnlocked

cpp/src/arrow/util/thread_pool.cc:696–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694bool ThreadPool::OwnsThisThread() { return GetCurrentThreadPool() == this; }
695
696Status ThreadPool::LaunchWorkersUnlocked(int threads) {
697 std::shared_ptr<State> state = sp_state_;
698
699 for (int i = 0; i < threads; i++) {
700 state_->workers_.emplace_back();
701 auto it = --(state_->workers_.end());
702 try {
703 *it = std::thread([this, state, it] {
704 SetCurrentThreadPool(this);
705 WorkerLoop(state, it);
706 });
707 } catch (const std::exception& e) {
708 state_->workers_.erase(it);
709 return Status::UnknownError("Failed to launch worker thread: ", e.what());
710 }
711 }
712 return Status::OK();
713}
714
715Status ThreadPool::SpawnReal(TaskHints hints, FnOnce<void()> task, StopToken stop_token,
716 StopCallback&& stop_callback) {

Callers

nothing calls this directly

Calls 7

SetCurrentThreadPoolFunction · 0.85
WorkerLoopFunction · 0.85
UnknownErrorFunction · 0.85
emplace_backMethod · 0.80
OKFunction · 0.50
endMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected