QThreadPool: use swap() when making a copy of allThreads
This is the C++98 version of std::move(). Change-Id: Icb73da16bb05bf07114a38e4fd48732b612e2d51 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
e2e1a08140
commit
d0ae7bef48
@ -269,9 +269,9 @@ void QThreadPoolPrivate::reset()
|
|||||||
runnableReady.wakeAll();
|
runnableReady.wakeAll();
|
||||||
|
|
||||||
while (!allThreads.empty()) {
|
while (!allThreads.empty()) {
|
||||||
// make a copy of the set so that we can iterate without the lock
|
// move the contents of the set out so that we can iterate without the lock
|
||||||
QSet<QThreadPoolThread *> allThreadsCopy = allThreads;
|
QSet<QThreadPoolThread *> allThreadsCopy;
|
||||||
allThreads.clear();
|
allThreadsCopy.swap(allThreads);
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
foreach (QThreadPoolThread *thread, allThreadsCopy) {
|
foreach (QThreadPoolThread *thread, allThreadsCopy) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user