diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-08-17 10:53:53 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-17 16:27:49 +0200 |
commit | e2e1a081408c23ea0c67a725cd57f1820e51b2a2 (patch) | |
tree | 6107610584dd39a27261daf7acbc2cbebd374393 /src | |
parent | 6ac6bc03e840d1b84dc953cade61838131e9c293 (diff) |
QThreadPool: don't loop unless needed
The resulting code is easier to understand, too.
Change-Id: I3cd84d85b3186860dd3ccd67c3771b82695e7f83
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index abbb683b83..4c705f5a93 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -268,7 +268,7 @@ void QThreadPoolPrivate::reset() isExiting = true; runnableReady.wakeAll(); - do { + while (!allThreads.empty()) { // make a copy of the set so that we can iterate without the lock QSet<QThreadPoolThread *> allThreadsCopy = allThreads; allThreads.clear(); @@ -281,7 +281,7 @@ void QThreadPoolPrivate::reset() locker.relock(); // repeat until all newly arrived threads have also completed - } while (!allThreads.isEmpty()); + } waitingThreads = 0; expiredThreads.clear(); |