Fix tst_qthreadpool under high load.

The tasks might not have run yet at the time of the QCOMPARE, so we need
to acquire on the semaphore in order to ensure that this is the case,
just like in the previous testcase.

Change-Id: I1da72bb07c2f53760b3bf912fc26aaf10ed18d48
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
David Faure 2014-03-13 21:14:35 +01:00 committed by The Qt Project
parent b14e4eb5f0
commit c4650779c4
1 changed files with 1 additions and 0 deletions

View File

@ -381,6 +381,7 @@ void tst_QThreadPool::expiryTimeoutRace() // QTBUG-3786
threadPool.start(&task);
QThread::msleep(50); // exactly the same as the expiry timeout
}
QVERIFY(task.semaphore.tryAcquire(numTasks, 10000));
QCOMPARE(task.runCount.load(), numTasks);
QVERIFY(threadPool.waitForDone(2000));
}