From ee632a21f6d4f6ea1d4fe7e41cca0fee307c5e39 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 26 Nov 2015 12:13:14 +0100 Subject: tst_QWaitCondition::wakeOne(): Increase wait interval. Introduce constants and make the interval for the 2nd thread a bit longer. Task-number: QTBUG-49653 Change-Id: I92ac0494ec6c9af5bde858007d08e26210215434 Reviewed-by: Joerg Bornemann --- .../auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp index 6a2ea7c73c..df52aa4949 100644 --- a/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp @@ -453,6 +453,9 @@ public: void tst_QWaitCondition::wakeOne() { + static const int firstWaitInterval = 1000; + static const int waitInterval = 30; + int x; QAtomicInt count; // wake up threads, one at a time @@ -497,7 +500,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (thread[y].wait(exited > 0 ? 10 : 1000)) { + if (thread[y].wait(exited > 0 ? waitInterval : firstWaitInterval)) { thread_exited[y] = true; ++exited; } @@ -546,7 +549,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (rwthread[y].wait(exited > 0 ? 10 : 1000)) { + if (rwthread[y].wait(exited > 0 ? waitInterval : firstWaitInterval)) { thread_exited[y] = true; ++exited; } @@ -603,7 +606,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (thread[y].wait(exited > 0 ? 10 : 1000)) { + if (thread[y].wait(exited > 0 ? waitInterval : firstWaitInterval)) { thread_exited[y] = true; ++exited; } @@ -654,7 +657,7 @@ void tst_QWaitCondition::wakeOne() for (int y = 0; y < ThreadCount; ++y) { if (thread_exited[y]) continue; - if (rwthread[y].wait(exited > 0 ? 10 : 1000)) { + if (rwthread[y].wait(exited > 0 ? waitInterval : firstWaitInterval)) { thread_exited[y] = true; ++exited; } -- cgit v1.2.3