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

Function SleepFor

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

Source from the content-addressed store, hash-verified

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