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

Method RestartTask

cpp/src/arrow/util/async_generator.h:1696–1715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1694 }
1695
1696 Future<T> RestartTask(std::shared_ptr<State> state, util::Mutex::Guard guard,
1697 Future<T> next) {
1698 if (TaskIsRunning()) {
1699 // If the task is still cleaning up we need to wait for it to finish before
1700 // restarting. We also want to block the consumer until we've restarted the
1701 // reader to avoid multiple restarts
1702 return task_finished.Then([state, next]() {
1703 // This may appear dangerous (recursive mutex) but we should be guaranteed the
1704 // outer guard has been released by this point. We know...
1705 // * task_finished is not already finished (it would be invalid in that case)
1706 // * task_finished will not be marked complete until we've given up the mutex
1707 auto guard_ = state->mutex.Lock();
1708 state->DoRestartTask(state, std::move(guard_));
1709 return next;
1710 });
1711 }
1712 // Otherwise we can restart immediately
1713 DoRestartTask(std::move(state), std::move(guard));
1714 return next;
1715 }
1716
1717 internal::Executor* io_executor;
1718 const int max_q;

Callers 1

operator()Method · 0.80

Calls 3

ThenMethod · 0.80
DoRestartTaskMethod · 0.80
LockMethod · 0.45

Tested by

no test coverage detected