| 755 | } |
| 756 | |
| 757 | void SleepFor(double seconds) { |
| 758 | #ifdef ARROW_ENABLE_THREADING |
| 759 | std::this_thread::sleep_for( |
| 760 | std::chrono::nanoseconds(static_cast<int64_t>(seconds * 1e9))); |
| 761 | #else |
| 762 | using Clock = std::chrono::steady_clock; |
| 763 | using DurationDouble = std::chrono::duration<double>; |
| 764 | |
| 765 | auto secs_left = DurationDouble(seconds); |
| 766 | auto start_time = Clock::now(); |
| 767 | auto end_time = start_time + secs_left; |
| 768 | while (Clock::now() < end_time) { |
| 769 | bool run_task = arrow::internal::SerialExecutor::RunTasksOnAllExecutors(); |
| 770 | if (!run_task) { |
| 771 | // all executors are empty, just sleep for the rest of the time |
| 772 | std::this_thread::sleep_for(end_time - Clock::now()); |
| 773 | } |
| 774 | // run one task then check time |
| 775 | } |
| 776 | #endif |
| 777 | } |
| 778 | |
| 779 | #ifdef _WIN32 |
| 780 | void SleepABit() { |
no outgoing calls
no test coverage detected