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

Method operator()

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

Source from the content-addressed store, hash-verified

304 std::move(is_next), std::move(initial_value))) {}
305
306 Future<T> operator()() {
307 {
308 auto guard = state_->mutex.Lock();
309 // We can send a result immediately if the top of the queue is either an
310 // error or the next item
311 if (!state_->queue.empty() &&
312 (!state_->queue.top().ok() ||
313 state_->is_next(state_->previous_value, *state_->queue.top()))) {
314 auto result = std::move(state_->queue.top());
315 if (result.ok()) {
316 state_->previous_value = *result;
317 }
318 state_->queue.pop();
319 return Future<T>::MakeFinished(result);
320 }
321 if (state_->finished) {
322 return AsyncGeneratorEnd<T>();
323 }
324 // The next item is not in the queue so we will need to wait
325 auto new_waiting_fut = Future<T>::Make();
326 state_->waiting_future = new_waiting_fut;
327 guard.Unlock();
328 state_->source().AddCallback(Callback{state_});
329 return new_waiting_fut;
330 }
331 }
332
333 private:
334 struct WrappedComesAfter {

Callers

nothing calls this directly

Calls 7

sourceMethod · 0.80
MakeFunction · 0.70
LockMethod · 0.45
emptyMethod · 0.45
okMethod · 0.45
UnlockMethod · 0.45
AddCallbackMethod · 0.45

Tested by

no test coverage detected