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

Function SleepFor

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

Source from the content-addressed store, hash-verified

755}
756
757void 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
780void SleepABit() {

Callers 15

NextMethod · 0.85
WaitForStartupMethod · 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

Calls

no outgoing calls

Tested by

no test coverage detected