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:
Marc Mutz 2012-08-17 10:55:38 +02:00 committed by Qt by Nokia
parent e2e1a08140
commit d0ae7bef48

View File

@ -269,9 +269,9 @@ void QThreadPoolPrivate::reset()
runnableReady.wakeAll();
while (!allThreads.empty()) {
// make a copy of the set so that we can iterate without the lock
QSet<QThreadPoolThread *> allThreadsCopy = allThreads;
allThreads.clear();
// move the contents of the set out so that we can iterate without the lock
QSet<QThreadPoolThread *> allThreadsCopy;
allThreadsCopy.swap(allThreads);
locker.unlock();
foreach (QThreadPoolThread *thread, allThreadsCopy) {