Go to file
Marc Mutz e0cad1aab5 QTestLib: modernize and stream-line WatchDog
... by porting from (QWaitCondition,QMutex) to std::{condition_variable,
mutex} and making the code more accessible by introducing explicit
states.

This patch was originally starting out to just replace QWaitCondition
with std::condition_variable, which is faster and more compact, and
the patch still does that, too. The focus, however, has shifted
towards improving the accessibility of the code, in particular its
states and the transitions between them.

Due to the way QWaitCondition prevents spurious wakeups, this code
could use its QWaitCondition as a semaphore, e.g. where it was calling
wait() in the ctor to be released only when the thread it started has
entered run(). That makes the code unnecessarily hard to follow.

Fix by introducing an enum Expectation which tells what the watch-dog
is currently waiting for, and unmistakably determines the state the
watch-dog is in: ThreadStart, TestFunctionStart, ... The timeout value
is now selected based on the Expectation value, so the timeout is no
longer serving as the implicit state, either.

Also port the defaultTimeout() function to return a
std::chrono::milliseconds directly. Elsewhere in Qt, we guard against
lack of <chrono>, so this unguarded use will also serve as a guide to
see whether all supported platforms now, eight Qt releases after we
formally require C++11 for Qt usage, provide it. Without <chrono>,
there's no timed waiting in the standard library.

Change-Id: If97b601c4090a2a2926fa58c903cfe3ec2656324
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-09-17 10:33:05 +00:00
bin Make sure QLatin1Literal fwd header is generated 2019-09-02 11:33:54 +02:00
config.tests Say hello to Android multi arch build in one go 2019-08-26 12:59:15 +03:00
dist Merge remote-tracking branch 'origin/5.12' into 5.13 2019-09-08 11:33:28 +02:00
doc Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-09 07:51:49 +00:00
examples Merge remote-tracking branch 'origin/5.14' into 5.15 2019-09-16 01:00:07 +02:00
lib
mkspecs Revert "configure: actually resolve libraries into full filepaths" 2019-09-13 10:47:38 +02:00
qmake Merge remote-tracking branch 'origin/5.13' into 5.14 2019-09-09 07:51:49 +00:00
src QTestLib: modernize and stream-line WatchDog 2019-09-17 10:33:05 +00:00
tests Merge remote-tracking branch 'origin/5.14' into 5.15 2019-09-17 01:00:15 +02:00
util QUnicodeTables: use array for case folding tables 2019-09-04 16:35:37 +00:00
.gitattributes
.gitignore qfloat16: Check in the tables to Git 2019-06-03 10:42:53 -07:00
.qmake.conf Bump version 2019-08-27 09:10:31 +03:00
.tag
config_help.txt Merge remote-tracking branch 'origin/5.14' into 5.15 2019-09-05 08:58:25 +02:00
configure Fix typo in configure script 2019-07-24 10:42:16 +09:00
configure.bat Configure: simplify logic 2019-03-14 12:13:58 +00:00
configure.json Make Qt relocatable 2019-09-07 20:02:45 +02:00
configure.pri Make Qt relocatable 2019-09-07 20:02:45 +02:00
header.BSD Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.COMM Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.FDL Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.GPL Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.GPL-EXCEPT Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL3 Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL3-COMM Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL-NOGPL2 Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.LGPL-ONLY Use placeholder for year in header.* files 2018-04-16 11:02:22 +00:00
header.MIT qsimd: add support for new x86 CPU features 2018-05-05 06:20:07 +00:00
INSTALL INSTALL: Remove outdated reference to Windows CE 2019-02-13 13:01:57 +00:00
LICENSE.FDL
LICENSE.GPL2
LICENSE.GPL3
LICENSE.GPL3-EXCEPT
LICENSE.LGPL3
LICENSE.LGPLv3
LICENSE.QT-LICENSE-AGREEMENT-4.0 Replace commercial preview license with Qt License Agreement 4.0 2018-06-21 11:39:15 +00:00
qtbase.pro
sync.profile CMake: Add support for auto-importing plugins in CMake 2019-08-12 18:23:58 +02:00