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:
|
public:
|
||||||
WatchDog()
|
WatchDog()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
timeout.store(-1);
|
timeout.store(-1);
|
||||||
start();
|
start();
|
||||||
|
waitCondition.wait(&mutex);
|
||||||
}
|
}
|
||||||
~WatchDog() {
|
~WatchDog() {
|
||||||
{
|
{
|
||||||
@ -2072,6 +2074,7 @@ public:
|
|||||||
|
|
||||||
void run() {
|
void run() {
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
|
waitCondition.wakeAll();
|
||||||
while (1) {
|
while (1) {
|
||||||
int t = timeout.load();
|
int t = timeout.load();
|
||||||
if (!t)
|
if (!t)
|
||||||
|
Loading…
Reference in New Issue
Block a user