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

Method operator()

cpp/src/arrow/c/bridge.cc:2742–2769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2740 };
2741
2742 Status operator()(const std::shared_ptr<RecordBatch>& record) {
2743 std::unique_lock<std::mutex> lock(state_->mutex_);
2744 if (state_->pending_requests_ == 0) {
2745 state_->cv_.wait(lock, [this]() -> bool {
2746 return !state_->error_.ok() || state_->pending_requests_ > 0;
2747 });
2748 }
2749
2750 if (!state_->error_.ok()) {
2751 return state_->error_;
2752 }
2753
2754 if (state_->pending_requests_ > 0) {
2755 state_->pending_requests_--;
2756 lock.unlock();
2757
2758 ArrowAsyncTask task;
2759 task.private_data = new PrivateTaskData{state_, record};
2760 task.extract_data = AsyncProducer::extract_data;
2761
2762 if (int status = handler_->on_next_task(handler_, &task, nullptr) != 0) {
2763 delete reinterpret_cast<PrivateTaskData*>(task.private_data);
2764 return Status::UnknownError("Received error from handler::on_next_task ", status);
2765 }
2766 }
2767
2768 return Status::OK();
2769 }
2770
2771 static void request(struct ArrowAsyncProducer* producer, int64_t n) {
2772 auto* self = reinterpret_cast<State*>(producer->private_data);

Callers

nothing calls this directly

Calls 4

UnknownErrorFunction · 0.85
on_next_taskMethod · 0.80
OKFunction · 0.50
okMethod · 0.45

Tested by

no test coverage detected