qt5base-lts/tests/auto/corelib/thread/qthreadpool
Marc Mutz b4689401a5 tst_QThreadPool: don't deadlock when a cancel() test fails
We keep the runnables from finishing by having them block
on a QSemaphore::acquire() call inside run().

If we fail a test that precedes the call to sem.release()
further into the test, the early return will cause the
thread pool to be destroyed, which will then attempt to
wait for the runnables to finished, which, in turn wait
for the semaphore to be released.

-> dead lock

Fix by introducing a RAII object to release the semaphore
with a sufficiently large number to unblock all runnables.
That number will in some situations be too large, but that
does not matter.

Change-Id: I1ec7e29b37bc36309e93e6e30708cc7db3c9579c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-02-15 11:25:48 +00:00
..
.gitignore Move QtConcurrent into its own module 2012-02-05 17:49:16 +01:00
BLACKLIST tst_QThreadPool::tryStartCount(): Wait until tasks have finished. 2015-11-27 10:58:24 +00:00
qthreadpool.pro Tests: Remove CONFIG += parallel_test. 2015-09-05 07:16:50 +00:00
tst_qthreadpool.cpp tst_QThreadPool: don't deadlock when a cancel() test fails 2017-02-15 11:25:48 +00:00