MCPcopy Create free account
hub / github.com/apache/arrow / operator()

Method operator()

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

Source from the content-addressed store, hash-verified

1726 cleanup_(std::make_shared<Cleanup>(state_.get())) {}
1727
1728 Future<T> operator()() {
1729 auto guard = state_->mutex.Lock();
1730 Future<T> waiting_future;
1731 if (state_->queue.empty()) {
1732 if (state_->finished) {
1733 return AsyncGeneratorEnd<T>();
1734 } else {
1735 waiting_future = Future<T>::Make();
1736 state_->waiting_future = waiting_future;
1737 }
1738 } else {
1739 auto next = Future<T>::MakeFinished(std::move(state_->queue.front()));
1740 state_->queue.pop();
1741 if (state_->NeedsRestart()) {
1742 return state_->RestartTask(state_, std::move(guard), std::move(next));
1743 }
1744 return next;
1745 }
1746 // This should only trigger the very first time this method is called
1747 if (state_->NeedsRestart()) {
1748 return state_->RestartTask(state_, std::move(guard), std::move(waiting_future));
1749 }
1750 return waiting_future;
1751 }
1752
1753 protected:
1754 static constexpr uint64_t kUnlikelyThreadId{std::numeric_limits<uint64_t>::max()};

Callers

nothing calls this directly

Calls 5

NeedsRestartMethod · 0.80
RestartTaskMethod · 0.80
MakeFunction · 0.70
LockMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected