qt6-bb10/tests/auto/corelib/thread
Marc Mutz 494ee2aa8d QThreadPool: supersede cancel() with tryTake()
The cancel() function added in 5b11e43e for Qt 5.5 suffers from a
number of problems:

First, if runnable->autoDelete() is true, then the function suffers
from the ABA problem (see documentation written for trytake()).

Second, if runnable->autoDelete() is false, due to cancel() throwing
away crucial information instead of returning it, the caller cannot
know whether the runnable was canceled (and thus has to be deleted),
wasn't found or is currently executing (and thus mustn't be deleted),
or has finished executing (and can be used to extract the result).

Deprecate this dangerous API and replace it with the much more useful
Private::stealRunnable(), promoted to public API and renamed to
tryTake() for consistency with the rest of Qt.

Described the various caveats in the function's documentation.

[ChangeLog][QtCore][QThreadPool] The cancel() function suffers from
several subtle issues and has been replaced with a new tryTake()
function.

Change-Id: I93125935614087efa24b3e3969dd6718aeabaa4f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-02-22 16:37:07 +00:00
..
qatomicint Add Intel copyright to files that Intel has had non-trivial contribution 2016-01-21 22:44:21 +00:00
qatomicinteger Merge remote-tracking branch 'origin/5.6' into 5.7 2016-03-24 20:37:33 +01:00
qatomicpointer Add Intel copyright to files that Intel has had non-trivial contribution 2016-01-21 22:44:21 +00:00
qfuture Drop unnecessary dependencies from some tests 2017-01-10 16:34:52 +00:00
qfuturesynchronizer Drop unnecessary dependencies from some tests 2017-01-10 16:34:52 +00:00
qfuturewatcher Updated license headers 2016-01-21 18:55:18 +00:00
qmutex Long live QTest::addRow()! 2017-01-10 07:47:26 +00:00
qmutexlocker Updated license headers 2016-01-21 18:55:18 +00:00
qreadlocker Updated license headers 2016-01-21 18:55:18 +00:00
qreadwritelock Updated license headers 2016-01-21 18:55:18 +00:00
qresultstore Drop unnecessary dependencies from some tests 2017-01-10 16:34:52 +00:00
qsemaphore Merge remote-tracking branch 'origin/5.8' into 5.9 2017-02-16 21:51:11 +01:00
qthread Merge remote-tracking branch 'origin/5.7' into 5.8 2016-11-24 10:31:21 +01:00
qthreadonce QtCore: Remove Windows CE. 2016-03-30 11:22:47 +00:00
qthreadpool QThreadPool: supersede cancel() with tryTake() 2017-02-22 16:37:07 +00:00
qthreadstorage macOS: Don't build auto-tests as application bundles unless explicitly requested 2016-10-23 10:39:56 +00:00
qwaitcondition Blacklist tst_QWaitCondition::wakeOne() on Windows 2017-02-14 06:51:52 +00:00
qwritelocker Updated license headers 2016-01-21 18:55:18 +00:00
thread.pro Replace the type-based QAtomicIntegerTraits with a size-based one 2014-01-30 18:06:27 +01:00