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

Method AddTask

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

Source from the content-addressed store, hash-verified

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

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