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

Method Shutdown

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

Source from the content-addressed store, hash-verified

604}
605
606Status ThreadPool::Shutdown(bool wait) {
607 std::unique_lock<std::mutex> lock(state_->mutex_);
608
609 if (state_->please_shutdown_) {
610 return Status::Invalid("Shutdown() already called");
611 }
612 state_->please_shutdown_ = true;
613 state_->quick_shutdown_ = !wait;
614 state_->cv_.notify_all();
615 state_->cv_shutdown_.wait(lock, [this] { return state_->workers_.empty(); });
616 if (!state_->quick_shutdown_) {
617 DCHECK_EQ(state_->pending_tasks_.size(), 0);
618 } else {
619 std::priority_queue<QueuedTask> empty;
620 std::swap(state_->pending_tasks_, empty);
621 }
622 CollectFinishedWorkersUnlocked();
623 return Status::OK();
624}
625
626void ThreadPool::CollectFinishedWorkersUnlocked() {
627 for (auto& thread : state_->finished_workers_) {

Callers 11

ThreadPoolSpawnFunction · 0.45
ThreadPoolSubmitFunction · 0.45
ThreadedTaskGroupFunction · 0.45
TEST_PFunction · 0.45
TearDownMethod · 0.45
TEST_FFunction · 0.45
~SignalStopStateMethod · 0.45
DoSpawnAddsMethod · 0.45
DoSpawnAddsThreadedMethod · 0.45
TEST_FFunction · 0.45
ASSERT_OK_AND_ASSIGNFunction · 0.45

Calls 5

swapFunction · 0.85
InvalidFunction · 0.50
OKFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by 7

TEST_PFunction · 0.36
TearDownMethod · 0.36
TEST_FFunction · 0.36
DoSpawnAddsMethod · 0.36
DoSpawnAddsThreadedMethod · 0.36
TEST_FFunction · 0.36
ASSERT_OK_AND_ASSIGNFunction · 0.36