| 134 | bool ok() const override { return ok_.load(); } |
| 135 | |
| 136 | Status Finish() override { |
| 137 | #ifdef ARROW_ENABLE_THREADING |
| 138 | std::unique_lock<std::mutex> lock(mutex_); |
| 139 | if (!finished_) { |
| 140 | cv_.wait(lock, [&]() { return nremaining_.load() == 0; }); |
| 141 | // Current tasks may start other tasks, so only set this when done |
| 142 | finished_ = true; |
| 143 | } |
| 144 | #else |
| 145 | while (!finished_ && nremaining_.load() != 0) { |
| 146 | arrow::internal::SerialExecutor::RunTasksOnAllExecutors(); |
| 147 | } |
| 148 | finished_ = true; |
| 149 | #endif |
| 150 | return status_; |
| 151 | } |
| 152 | |
| 153 | Future<> FinishAsync() override { |
| 154 | std::lock_guard<std::mutex> lock(mutex_); |