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

Method RestartTask

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

Source from the content-addressed store, hash-verified

1800 }
1801
1802 Future<T> RestartTask(std::shared_ptr<State> state, util::Mutex::Guard guard,
1803 Future<T> next) {
1804 if (TaskIsRunning()) {
1805 // If the task is still cleaning up we need to wait for it to finish before
1806 // restarting. We also want to block the consumer until we've restarted the
1807 // reader to avoid multiple restarts
1808 return task_finished.Then([state, next]() {
1809 // This may appear dangerous (recursive mutex) but we should be guaranteed the
1810 // outer guard has been released by this point. We know...
1811 // * task_finished is not already finished (it would be invalid in that case)
1812 // * task_finished will not be marked complete until we've given up the mutex
1813 auto guard_ = state->mutex.Lock();
1814 state->DoRestartTask(state, std::move(guard_));
1815 return next;
1816 });
1817 }
1818 // Otherwise we can restart immediately
1819 DoRestartTask(std::move(state), std::move(guard));
1820 return next;
1821 }
1822
1823 internal::Executor* io_executor;
1824 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