Improve safety of QTestLib watchdog
Reduce the side-effects of QThread start-up happening concurrently while test functions begin to execute by terminating the WatchDog constructor only when the thread itself is up and running. Change-Id: I21ee44206d789a7ecb5a220ee4729572548c0277 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
71203b1f0e
commit
5fd3539cfd
@ -2046,8 +2046,10 @@ class WatchDog : public QThread
|
||||
public:
|
||||
WatchDog()
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
timeout.store(-1);
|
||||
start();
|
||||
waitCondition.wait(&mutex);
|
||||
}
|
||||
~WatchDog() {
|
||||
{
|
||||
@ -2072,6 +2074,7 @@ public:
|
||||
|
||||
void run() {
|
||||
QMutexLocker locker(&mutex);
|
||||
waitCondition.wakeAll();
|
||||
while (1) {
|
||||
int t = timeout.load();
|
||||
if (!t)
|
||||
|
Loading…
Reference in New Issue
Block a user