| 1185 | } |
| 1186 | |
| 1187 | Future<> RunTaskFuture() { |
| 1188 | num_running_++; |
| 1189 | // post the unlock check as a separate task |
| 1190 | // otherwise we'll never let anything else run |
| 1191 | // so nothing can unlock us |
| 1192 | using Clock = std::chrono::steady_clock; |
| 1193 | using DurationDouble = std::chrono::duration<double>; |
| 1194 | using DurationClock = std::chrono::steady_clock::duration; |
| 1195 | |
| 1196 | auto start_time = Clock::now(); |
| 1197 | auto secs_left = DurationDouble(timeout_seconds_); |
| 1198 | auto end_time = std::chrono::time_point_cast<DurationClock, Clock, DurationDouble>( |
| 1199 | start_time + secs_left); |
| 1200 | auto executor = arrow::internal::GetCpuThreadPool(); |
| 1201 | auto future = Future<>::Make(); |
| 1202 | auto spawn_status = executor->Spawn([this, end_time, executor, future]() { |
| 1203 | WaitForEndOrUnlocked(end_time, executor, future); |
| 1204 | }); |
| 1205 | if (!spawn_status.ok()) { |
| 1206 | status_ &= Status::Invalid("Couldn't spawn gating task unlock waiter"); |
| 1207 | future.MarkFinished(Status::Invalid("")); |
| 1208 | } |
| 1209 | return future; |
| 1210 | } |
| 1211 | |
| 1212 | void RunTask() { |
| 1213 | #ifdef ARROW_ENABLE_THREADING |
nothing calls this directly
no test coverage detected