QTest::qWaitFor: remove superfluous check for isForever()

When a QDeadLineTimer::isForever() then its remainingTime() is
chrono::nanoseconds::max(), which is exactly representable as
chrono::milliseconds, and greater than 10ms, so the following code
would have done the right thing already.

Let it.

This also removes the duplicate mentioning of the 10ms sleeping
timeslice.

Amends fa296ee1dcf4c16fb6f242cf08949485e499fec3.

Change-Id: Ibc32d6069b78cd4583df07d0707d98645440b36c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e102edfbf8db3a0a541de2a8a3e3782b7e5b234b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-03-08 11:27:57 +01:00 committed by Qt Cherry-pick Bot
parent d46f88c049
commit f75c76fac0

View File

@ -45,11 +45,6 @@ qWaitFor(Functor predicate, QDeadlineTimer deadline = QDeadlineTimer(std::chrono
if (predicate())
return true;
if (deadline.isForever()) { // No point checking remaining time
qSleep(10ms);
continue;
}
const auto remaining = ceil<milliseconds>(deadline.remainingTimeAsDuration());
if (remaining == 0ms)
break;