diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-04-19 19:02:54 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-04-26 11:54:24 (GMT) |
commit | 51c40fdceaa7caec60f8934d9f95dbff76d5ed8e (patch) | |
tree | 2f9054aa34b1b3215d21622976ffc42a414db3dd /src/network | |
parent | 7cfb1403dc66e9151edc5a6c9b723444f2584941 (diff) | |
download | Qt-51c40fdceaa7caec60f8934d9f95dbff76d5ed8e.zip Qt-51c40fdceaa7caec60f8934d9f95dbff76d5ed8e.tar.gz Qt-51c40fdceaa7caec60f8934d9f95dbff76d5ed8e.tar.bz2 |
Don't rely on tryStart() to do job control.
It may fail but threads become available the next instant. Instead,
simply use our own currentLookups count.
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 7e006e0..f287630 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -565,13 +565,11 @@ void QHostInfoLookupManager::work() } } - if (scheduled && threadPool.tryStart(scheduled)) { + if (scheduled && currentLookups.size() < threadPool.maxThreadCount()) { // runnable now running in new thread, track this in currentLookups + threadPool.start(scheduled); iterator.remove(); currentLookups.append(scheduled); - } else if (scheduled) { - // wanted to start, but could not because thread pool is busy - break; } else { // was postponed, continue iterating continue; |