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