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

Method Make

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

Source from the content-addressed store, hash-verified

461} // namespace
462
463Future<> AsyncTaskScheduler::Make(FnOnce<Status(AsyncTaskScheduler*)> initial_task,
464 FnOnce<void(const Status&)> abort_callback,
465 StopToken stop_token) {
466 util::tracing::Span span;
467 auto scope = START_SCOPED_SPAN_SV(span, "AsyncTaskScheduler::InitialTask"sv);
468 auto scheduler = std::make_unique<AsyncTaskSchedulerImpl>(std::move(stop_token),
469 std::move(abort_callback));
470 Status initial_task_st;
471 // GH-47642: We normally don't catch exceptions in Arrow C++ code, as the error
472 // reporting model uses the Status object instead. Usually, an uncaught exception
473 // will simply terminate the process, surfacing the programming error.
474 // However, an exception thrown from the initial task would result in a much
475 // harder to diagnose process hang.
476 try {
477 initial_task_st = std::move(initial_task)(scheduler.get());
478 } catch (const std::exception& e) {
479 initial_task_st = Status::UnknownError("Initial task threw an exception: ", e.what());
480 } catch (...) {
481 initial_task_st = Status::UnknownError("Initial task threw an unknown exception");
482 }
483 scheduler->OnTaskFinished(std::move(initial_task_st));
484 // Keep scheduler alive until finished
485 return scheduler->OnFinished().Then([scheduler = std::move(scheduler)] {});
486}
487
488std::shared_ptr<ThrottledAsyncTaskScheduler> ThrottledAsyncTaskScheduler::Make(
489 AsyncTaskScheduler* target, int max_concurrent_cost,

Callers

nothing calls this directly

Calls 6

UnknownErrorFunction · 0.85
OnTaskFinishedMethod · 0.80
ThenMethod · 0.80
OnFinishedMethod · 0.80
getMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected