Adjust QTRY_IMPL()'s default timestep

It was previously using 50ms steps, which was a bad choice for client
code whose total time-out was comparable to 50ms or less.  Reduce the
time-step so that we loop several times within the timeout (but make
sure it's never zero, by adding 1ms).

Change-Id: I0428a7741c0741dfb312e40ae1eda900050195ab
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
This commit is contained in:
Edward Welbourne 2018-11-13 11:15:44 +01:00
parent 15b1c3fd9b
commit cd201b2c2c

View File

@ -150,7 +150,7 @@ do {\
// Ideally we'd use qWaitFor instead of QTRY_LOOP_IMPL, but due
// to a compiler bug on MSVC < 2017 we can't (see QTBUG-59096)
#define QTRY_IMPL(expr, timeout)\
const int qt_test_step = 50; \
const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \
const int qt_test_timeoutValue = timeout; \
QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \
QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\