| 137 | |
| 138 | private: |
| 139 | Status DoProcess(std::unique_lock<std::mutex>&& lk) { |
| 140 | while (!queue_.empty() && queue_.top().index == next_index_) { |
| 141 | ExecBatch next(queue_.top()); |
| 142 | queue_.pop(); |
| 143 | next_index_++; |
| 144 | lk.unlock(); |
| 145 | // ARROW_RETURN_NOT_OK may return early here. In that case is_processing_ will |
| 146 | // never switch to false so no other threads can process but that should be ok |
| 147 | // since we failed anyways. It is important however, that we do not hold the lock. |
| 148 | ARROW_RETURN_NOT_OK(processor_->Process(std::move(next))); |
| 149 | lk.lock(); |
| 150 | } |
| 151 | is_processing_ = false; |
| 152 | return Status::OK(); |
| 153 | } |
| 154 | |
| 155 | Processor* processor_; |
| 156 | |