MCPcopy Create free account
hub / github.com/apache/arrow / SleepFor

Function SleepFor

cpp/src/arrow/testing/gtest_util.cc:753–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751}
752
753void 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
776void SleepABit() {

Callers 15

NextMethod · 0.85
SleepABitFunction · 0.85
BusyWaitFunction · 0.85
NextMethod · 0.85
TestTaskGroupSuccessFunction · 0.85
TestTaskGroupErrorsFunction · 0.85
TestTaskGroupCancelFunction · 0.85
TestTasksSpawnTasksFunction · 0.85
operator()Method · 0.85
StressTaskGroupLifetimeFunction · 0.85
TestFinishNotStickyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected