qt6-bb10/tests/auto/corelib/thread
David Faure a9b6a78e54 QThreadPool: fix race at time of thread expiry.
The current synchronization mechanism was racy: decrementing waitingThreads
and then hoping that the wakeOne will wake a thread before its expiry
timeout happens. In other words, on timeout, a just-assigned task would
never run. And then no other task would run, if maxThreadCount is reached.

Fixed by using a queue of waiting threads (rather than just a count), and by
moving the wait condition into the thread itself, so we know precisely
which one we're waking up, and we can remove it from the set of waiting threads
before waking it up, and therefore it can determine on wakeup whether it
has work to do (caller removed it from the queue) or it expired (it's still
in the queue). This is reliable, whereas the return value from QWaitCondition::wait
isn't reliable, when the main thread has already decided that this thread
has work to do.

Task-number: QTBUG-3786
Change-Id: I1eac5d6c309daed7f483ac7a8074297bfda6ee32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-10-31 17:45:58 +01:00
..
qatomicint Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qatomicpointer Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qfuture Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qfuturesynchronizer Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qfuturewatcher Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qmutex tst_QMutex: fix a race 2013-09-23 02:47:49 +02:00
qmutexlocker Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qreadlocker Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qreadwritelock WinRT: Fix various test compilations 2013-10-02 12:36:05 +02:00
qresultstore Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qsemaphore Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qthread Winrt: Skip qthread autotests, which are not supported (yet) 2013-10-02 12:36:09 +02:00
qthreadonce Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qthreadpool QThreadPool: fix race at time of thread expiry. 2013-10-31 17:45:58 +01:00
qthreadstorage WinRT: Fix various test compilations 2013-10-02 12:36:05 +02:00
qwaitcondition Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qwritelocker Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
thread.pro Move QFutureSynchronizer back to QtCore 2012-09-28 23:50:10 +02:00