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

Method AddTask

cpp/src/arrow/util/async_util.cc:426–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424 }
425
426 bool AddTask(std::unique_ptr<Task> task) override {
427 state_->task_count++;
428 struct WrapperTask : public Task {
429 WrapperTask(std::unique_ptr<Task> target, std::shared_ptr<State> state)
430 : target(std::move(target)), state(std::move(state)) {}
431 Result<Future<>> operator()() override {
432 ARROW_ASSIGN_OR_RAISE(Future<> inner_fut, (*target)());
433 return inner_fut.Then([state = std::move(state)]() {
434 if (--state->task_count == 0) {
435 return std::move(state->finish_cb)();
436 }
437 return Status::OK();
438 });
439 }
440 int cost() const override { return target->cost(); }
441 std::string_view name() const override { return target->name(); }
442 std::unique_ptr<Task> target;
443 std::shared_ptr<State> state;
444 };
445 return target_->AddTask(std::make_unique<WrapperTask>(std::move(task), state_));
446 }
447
448 const util::tracing::Span& span() const override { return target_->span(); }
449

Callers 8

AddScanTasksMethod · 0.45
ScanFragmentsMethod · 0.45
RunMethod · 0.45
ListAsyncMethod · 0.45
operator()Method · 0.45
AddAsyncGeneratorMethod · 0.45
AddTaskMethod · 0.45
TESTFunction · 0.45

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.36