qthreadpool.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/thread/qthreadpool.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include "qthreadpool.h"-
35#include "qthreadpool_p.h"-
36#include "qelapsedtimer.h"-
37-
38#include <algorithm>-
39-
40#ifndef QT_NO_THREAD-
41-
42QT_BEGIN_NAMESPACE-
43-
44Q_GLOBAL_STATIC(QThreadPool, theInstance)
executed 970 times by 420 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
executed 970 times by 420 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
executed 1461081 times by 434 tests: return &holder.value;
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_compiler - unknown status
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 970 times by 420 tests
Evaluated by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
FALSEnever evaluated
0-1461081
45-
46/*-
47 QThread wrapper, provides synchronization against a ThreadPool-
48*/-
49class QThreadPoolThread : public QThread-
50{-
51public:-
52 QThreadPoolThread(QThreadPoolPrivate *manager);-
53 void run() Q_DECL_OVERRIDE;-
54 void registerThreadInactive();-
55-
56 QWaitCondition runnableReady;-
57 QThreadPoolPrivate *manager;-
58 QRunnable *runnable;-
59};-
60-
61/*-
62 QThreadPool private class.-
63*/-
64-
65-
66/*!-
67 \internal-
68*/-
69QThreadPoolThread::QThreadPoolThread(QThreadPoolPrivate *manager)-
70 :manager(manager), runnable(0)-
71{
executed 1182 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
}
executed 1182 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
1182
72-
73/*-
74 \internal-
75*/-
76void QThreadPoolThread::run()-
77{-
78 QMutexLocker locker(&manager->mutex);-
79 for(;;) {-
80 QRunnable *r = runnable;-
81 runnable = 0;-
82-
83 do {-
84 if (r) {
rDescription
TRUEevaluated 2409907 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEevaluated 2172734 times by 15 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
2172734-2409907
85 const bool autoDelete = r->autoDelete();-
86-
87-
88 // run the task-
89 locker.unlock();-
90#ifndef QT_NO_EXCEPTIONS-
91 try {-
92#endif-
93 r->run();-
94#ifndef QT_NO_EXCEPTIONS-
95 } catch (...) {
executed 2409907 times by 35 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2409907
96 qWarning("Qt Concurrent has caught an exception thrown from a worker thread.\n"-
97 "This is not supported, exceptions thrown in worker threads must be\n"-
98 "caught before control returns to Qt Concurrent.");-
99 registerThreadInactive();-
100 throw;
never executed: throw;
0
101 }-
102#endif-
103 locker.relock();-
104-
105 if (autoDelete && !--r->ref)
autoDeleteDescription
TRUEevaluated 1127175 times by 31 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEevaluated 1282732 times by 6 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
!--r->refDescription
TRUEevaluated 1127175 times by 31 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEnever evaluated
0-1282732
106 delete r;
executed 1127175 times by 31 tests: delete r;
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
1127175
107 }
executed 2409907 times by 35 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2409907
108-
109 // if too many threads are active, expire this thread-
110 if (manager->tooManyThreadsActive())
manager->tooMa...hreadsActive()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 4582639 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2-4582639
111 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QThreadPool
2
112-
113 r = !manager->queue.isEmpty() ? manager->queue.takeFirst().first : 0;
!manager->queue.isEmpty()Description
TRUEevaluated 2408710 times by 17 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
FALSEevaluated 2173929 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2173929-2408710
114 } while (r != 0);
executed 4582639 times by 35 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
r != 0Description
TRUEevaluated 2408710 times by 17 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
FALSEevaluated 2173929 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2173929-4582639
115-
116 if (manager->isExiting) {
manager->isExitingDescription
TRUEnever evaluated
FALSEevaluated 2173931 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-2173931
117 registerThreadInactive();-
118 break;
never executed: break;
0
119 }-
120-
121 // if too many threads are active, expire this thread-
122 bool expired = manager->tooManyThreadsActive();-
123 if (!expired) {
!expiredDescription
TRUEevaluated 2173929 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThreadPool
2-2173929
124 manager->waitingThreads.enqueue(this);-
125 registerThreadInactive();-
126 // wait for work, exiting after the expiry timeout is reached-
127 runnableReady.wait(locker.mutex(), manager->expiryTimeout);-
128 ++manager->activeThreads;-
129 if (manager->waitingThreads.removeOne(this))
manager->waiti...emoveOne(this)Description
TRUEevaluated 1194 times by 38 tests
Evaluated by:
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • ...
FALSEevaluated 2172734 times by 15 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
1194-2172734
130 expired = true;
executed 1194 times by 38 tests: expired = true;
Executed by:
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • ...
1194
131 }
executed 2173928 times by 47 tests: end of block
Executed by:
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • ...
2173928
132 if (expired) {
expiredDescription
TRUEevaluated 1196 times by 38 tests
Evaluated by:
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • ...
FALSEevaluated 2172734 times by 15 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
1196-2172734
133 manager->expiredThreads.enqueue(this);-
134 registerThreadInactive();-
135 break;
executed 1196 times by 38 tests: break;
Executed by:
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • ...
1196
136 }-
137 }
executed 2172734 times by 15 tests: end of block
Executed by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
2172734
138}
executed 1196 times by 38 tests: end of block
Executed by:
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QHostInfo
  • tst_QNetworkReply
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • ...
1196
139-
140void QThreadPoolThread::registerThreadInactive()-
141{-
142 if (--manager->activeThreads == 0)
--manager->activeThreads == 0Description
TRUEevaluated 2174870 times by 57 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • ...
FALSEevaluated 255 times by 7 tests
Evaluated by:
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QHostInfo
  • tst_QMimeDatabase
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUrl
255-2174870
143 manager->noActiveThreads.wakeAll();
executed 2174870 times by 57 tests: manager->noActiveThreads.wakeAll();
Executed by:
  • tst_Lancelot
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • ...
2174870
144}
executed 2175125 times by 58 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2175125
145-
146-
147/*-
148 \internal-
149*/-
150QThreadPoolPrivate:: QThreadPoolPrivate()-
151 : isExiting(false),-
152 expiryTimeout(30000),-
153 maxThreadCount(qAbs(QThread::idealThreadCount())),-
154 reservedThreads(0),-
155 activeThreads(0)-
156{
executed 1660 times by 445 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • ...
}
executed 1660 times by 445 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • ...
1660
157-
158bool QThreadPoolPrivate::tryStart(QRunnable *task)-
159{-
160 if (allThreads.isEmpty()) {
allThreads.isEmpty()Description
TRUEevaluated 958 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEevaluated 2475004 times by 22 tests
Evaluated by:
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
958-2475004
161 // always create at least one thread-
162 startThread(task);-
163 return true;
executed 958 times by 34 tests: return true;
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
958
164 }-
165-
166 // can't do anything if we're over the limit-
167 if (activeThreadCount() >= maxThreadCount)
activeThreadCo...maxThreadCountDescription
TRUEevaluated 302034 times by 10 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 2172970 times by 21 tests
Evaluated by:
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
302034-2172970
168 return false;
executed 302034 times by 10 tests: return false;
Executed by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
302034
169-
170 if (waitingThreads.count() > 0) {
waitingThreads.count() > 0Description
TRUEevaluated 2172731 times by 16 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
FALSEevaluated 239 times by 10 tests
Evaluated by:
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QHostInfo
  • tst_QMimeDatabase
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUrl
239-2172731
171 // recycle an available thread-
172 enqueueTask(task);-
173 waitingThreads.takeFirst()->runnableReady.wakeOne();-
174 return true;
executed 2172731 times by 16 tests: return true;
Executed by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
2172731
175 }-
176-
177 if (!expiredThreads.isEmpty()) {
!expiredThreads.isEmpty()Description
TRUEevaluated 15 times by 4 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QThreadPool
FALSEevaluated 224 times by 7 tests
Evaluated by:
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QHostInfo
  • tst_QMimeDatabase
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUrl
15-224
178 // restart an expired thread-
179 QThreadPoolThread *thread = expiredThreads.dequeue();-
180 Q_ASSERT(thread->runnable == 0);-
181-
182 ++activeThreads;-
183-
184 if (task->autoDelete())
task->autoDelete()Description
TRUEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QThreadPool
4-11
185 ++task->ref;
executed 11 times by 3 tests: ++task->ref;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
11
186 thread->runnable = task;-
187 thread->start();-
188 return true;
executed 15 times by 4 tests: return true;
Executed by:
  • tst_QFtp
  • tst_QNetworkReply
  • tst_QSocks5SocketEngine
  • tst_QThreadPool
15
189 }-
190-
191 // start a new thread-
192 startThread(task);-
193 return true;
executed 224 times by 7 tests: return true;
Executed by:
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QHostInfo
  • tst_QMimeDatabase
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUrl
224
194}-
195-
196inline bool operator<(int priority, const QPair<QRunnable *, int> &p)-
197{
executed 1 time by 1 test: return p.second < priority;
Executed by:
  • tst_QThreadPool
return p.second < priority; }
executed 1 time by 1 test: return p.second < priority;
Executed by:
  • tst_QThreadPool
1
198inline bool operator<(const QPair<QRunnable *, int> &p, int priority)-
199{
never executed: return priority < p.second;
return priority < p.second; }
never executed: return priority < p.second;
0
200-
201void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)-
202{-
203 if (runnable->autoDelete())
runnable->autoDelete()Description
TRUEevaluated 1192043 times by 14 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentRun
  • tst_Spdy
FALSEevaluated 1282720 times by 6 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
1192043-1282720
204 ++runnable->ref;
executed 1192043 times by 14 tests: ++runnable->ref;
Executed by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentRun
  • tst_Spdy
1192043
205-
206 // put it on the queue-
207 QVector<QPair<QRunnable *, int> >::const_iterator begin = queue.constBegin();-
208 QVector<QPair<QRunnable *, int> >::const_iterator it = queue.constEnd();-
209 if (it != begin && priority > (*(it - 1)).second)
it != beginDescription
TRUEevaluated 300174 times by 9 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 2174589 times by 18 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
priority > (*(it - 1)).secondDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 300172 times by 9 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
2-2174589
210 it = std::upper_bound(begin, --it, priority);
executed 2 times by 1 test: it = std::upper_bound(begin, --it, priority);
Executed by:
  • tst_QThreadPool
2
211 queue.insert(it - begin, qMakePair(runnable, priority));-
212}
executed 2474763 times by 18 tests: end of block
Executed by:
  • tst_QDnsLookup
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QLockFile
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
2474763
213-
214int QThreadPoolPrivate::activeThreadCount() const-
215{-
216 return (allThreads.count()
executed 9361902 times by 35 tests: return (allThreads.count() - expiredThreads.count() - waitingThreads.count() + reservedThreads);
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
9361902
217 - expiredThreads.count()
executed 9361902 times by 35 tests: return (allThreads.count() - expiredThreads.count() - waitingThreads.count() + reservedThreads);
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
9361902
218 - waitingThreads.count()
executed 9361902 times by 35 tests: return (allThreads.count() - expiredThreads.count() - waitingThreads.count() + reservedThreads);
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
9361902
219 + reservedThreads);
executed 9361902 times by 35 tests: return (allThreads.count() - expiredThreads.count() - waitingThreads.count() + reservedThreads);
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
9361902
220}-
221-
222void QThreadPoolPrivate::tryToStartMoreThreads()-
223{-
224 // try to push tasks on the queue to any available threads-
225 while (!queue.isEmpty() && tryStart(queue.first().first))
!queue.isEmpty()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 49800 times by 31 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QObject
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTextCodec
  • ...
tryStart(queue.first().first)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThreadPool
2-49800
226 queue.removeFirst();
executed 9 times by 1 test: queue.removeFirst();
Executed by:
  • tst_QThreadPool
9
227}
executed 49802 times by 31 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QObject
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTextCodec
  • ...
49802
228-
229bool QThreadPoolPrivate::tooManyThreadsActive() const-
230{-
231 const int activeThreadCount = this->activeThreadCount();-
232 return activeThreadCount > maxThreadCount && (activeThreadCount - reservedThreads) > 1;
executed 6756572 times by 35 tests: return activeThreadCount > maxThreadCount && (activeThreadCount - reservedThreads) > 1;
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
activeThreadCo...maxThreadCountDescription
TRUEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentRun
FALSEevaluated 6756555 times by 35 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
(activeThreadC...edThreads) > 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentRun
4-6756572
233}-
234-
235/*!-
236 \internal-
237*/-
238void QThreadPoolPrivate::startThread(QRunnable *runnable)-
239{-
240 QScopedPointer <QThreadPoolThread> thread(new QThreadPoolThread(this));-
241 thread->setObjectName(QLatin1String("Thread (pooled)"));-
242 allThreads.insert(thread.data());-
243 ++activeThreads;-
244-
245 if (runnable->autoDelete())
runnable->autoDelete()Description
TRUEevaluated 1164 times by 30 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
FALSEevaluated 18 times by 5 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
18-1164
246 ++runnable->ref;
executed 1164 times by 30 tests: ++runnable->ref;
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
1164
247 thread->runnable = runnable;-
248 thread.take()->start();-
249}
executed 1182 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
1182
250-
251/*!-
252 \internal-
253 Makes all threads exit, waits for each thread to exit and deletes it.-
254*/-
255void QThreadPoolPrivate::reset()-
256{-
257 QMutexLocker locker(&mutex);-
258 isExiting = true;-
259-
260 while (!allThreads.empty()) {
!allThreads.empty()Description
TRUEevaluated 957 times by 37 tests
Evaluated by:
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QHostInfo
  • tst_QPointer
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qftp - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qobject - unknown status
  • ...
FALSEevaluated 4369 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
957-4369
261 // move the contents of the set out so that we can iterate without the lock-
262 QSet<QThreadPoolThread *> allThreadsCopy;-
263 allThreadsCopy.swap(allThreads);-
264 locker.unlock();-
265-
266 foreach (QThreadPoolThread *thread, allThreadsCopy) {-
267 thread->runnableReady.wakeAll();-
268 thread->wait();-
269 delete thread;-
270 }
executed 1181 times by 37 tests: end of block
Executed by:
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QHostInfo
  • tst_QPointer
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qftp - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qobject - unknown status
  • ...
1181
271-
272 locker.relock();-
273 // repeat until all newly arrived threads have also completed-
274 }
executed 957 times by 37 tests: end of block
Executed by:
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QHostInfo
  • tst_QPointer
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_lancelot - unknown status
  • tst_qdebug - unknown status
  • tst_qdnslookup - unknown status
  • tst_qftp - unknown status
  • tst_qfuturewatcher - unknown status
  • tst_qhostinfo - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qlockfile - unknown status
  • tst_qmimedatabase-cache - unknown status
  • tst_qmimedatabase-xml - unknown status
  • tst_qnetworkdiskcache - unknown status
  • tst_qnetworkproxyfactory - unknown status
  • tst_qobject - unknown status
  • ...
957
275-
276 waitingThreads.clear();-
277 expiredThreads.clear();-
278-
279 isExiting = false;-
280}
executed 4369 times by 441 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
4369
281-
282bool QThreadPoolPrivate::waitForDone(int msecs)-
283{-
284 QMutexLocker locker(&mutex);-
285 if (msecs < 0) {
msecs < 0Description
TRUEevaluated 4366 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
5-4366
286 while (!(queue.isEmpty() && activeThreads == 0))
queue.isEmpty()Description
TRUEevaluated 4944 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
FALSEevaluated 12 times by 4 tests
Evaluated by:
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
activeThreads == 0Description
TRUEevaluated 4366 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
FALSEevaluated 578 times by 6 tests
Evaluated by:
  • tst_QDnsLookup_Appless
  • tst_QHostInfo
  • tst_QSslSocket
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_qdebug - unknown status
12-4944
287 noActiveThreads.wait(locker.mutex());
executed 590 times by 8 tests: noActiveThreads.wait(locker.mutex());
Executed by:
  • tst_QDnsLookup_Appless
  • tst_QHostInfo
  • tst_QPointer
  • tst_QSslSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_qdebug - unknown status
590
288 } else {
executed 4366 times by 441 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
4366
289 QElapsedTimer timer;-
290 timer.start();-
291 int t;-
292 while (!(queue.isEmpty() && activeThreads == 0) &&
queue.isEmpty()Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
FALSEnever evaluated
activeThreads == 0Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
0-8
293 ((t = msecs - timer.elapsed()) > 0))
((t = msecs - ...lapsed()) > 0)Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
2-3
294 noActiveThreads.wait(locker.mutex(), t);
executed 3 times by 2 tests: noActiveThreads.wait(locker.mutex(), t);
Executed by:
  • tst_QFuture
  • tst_QThreadPool
3
295 }
executed 5 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QThreadPool
5
296 return queue.isEmpty() && activeThreads == 0;
executed 4371 times by 441 tests: return queue.isEmpty() && activeThreads == 0;
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
queue.isEmpty()Description
TRUEevaluated 4371 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
FALSEnever evaluated
activeThreads == 0Description
TRUEevaluated 4369 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
0-4371
297}-
298-
299void QThreadPoolPrivate::clear()-
300{-
301 QMutexLocker locker(&mutex);-
302 for (QVector<QPair<QRunnable *, int> >::const_iterator it = queue.constBegin();-
303 it != queue.constEnd(); ++it) {
it != queue.constEnd()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QThreadPool
1-11
304 QRunnable* r = it->first;-
305 if (r->autoDelete() && !--r->ref)
r->autoDelete()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEnever evaluated
!--r->refDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEnever evaluated
0-11
306 delete r;
executed 11 times by 1 test: delete r;
Executed by:
  • tst_QThreadPool
11
307 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QThreadPool
11
308 queue.clear();-
309}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QThreadPool
1
310-
311/*!-
312 \internal-
313 Searches for \a runnable in the queue, removes it from the queue and-
314 returns \c true if it was found in the queue-
315*/-
316bool QThreadPoolPrivate::stealRunnable(QRunnable *runnable)-
317{-
318 if (runnable == 0)
runnable == 0Description
TRUEevaluated 66611 times by 6 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 66071 times by 7 tests
Evaluated by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QThreadPool
  • tst_QUrl
  • tst_QtConcurrentRun
66071-66611
319 return false;
executed 66611 times by 6 tests: return false;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
66611
320 {-
321 QMutexLocker locker(&mutex);-
322 QVector<QPair<QRunnable *, int> >::iterator it = queue.begin();-
323 QVector<QPair<QRunnable *, int> >::iterator end = queue.end();-
324-
325 while (it != end) {
it != endDescription
TRUEevaluated 699069 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QThreadPool
  • tst_QtConcurrentRun
FALSEevaluated 39 times by 7 tests
Evaluated by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QThreadPool
  • tst_QUrl
  • tst_QtConcurrentRun
39-699069
326 if (it->first == runnable) {
it->first == runnableDescription
TRUEevaluated 66032 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QThreadPool
  • tst_QtConcurrentRun
FALSEevaluated 633037 times by 3 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentRun
66032-633037
327 queue.erase(it);-
328 return true;
executed 66032 times by 4 tests: return true;
Executed by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QThreadPool
  • tst_QtConcurrentRun
66032
329 }-
330 ++it;-
331 }
executed 633037 times by 3 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentRun
633037
332 }-
333-
334 return false;
executed 39 times by 7 tests: return false;
Executed by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QThreadPool
  • tst_QUrl
  • tst_QtConcurrentRun
39
335}-
336-
337 /*!-
338 \internal-
339 Searches for \a runnable in the queue, removes it from the queue and-
340 runs it if found. This function does not return until the runnable-
341 has completed.-
342 */-
343void QThreadPoolPrivate::stealAndRunRunnable(QRunnable *runnable)-
344{-
345 if (!stealRunnable(runnable))
!stealRunnable(runnable)Description
TRUEevaluated 66641 times by 11 tests
Evaluated by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 66029 times by 3 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentRun
66029-66641
346 return;
executed 66641 times by 11 tests: return;
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
66641
347 const bool autoDelete = runnable->autoDelete();-
348 bool del = autoDelete && !--runnable->ref;
autoDeleteDescription
TRUEevaluated 66029 times by 3 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentRun
FALSEnever evaluated
!--runnable->refDescription
TRUEevaluated 66029 times by 3 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentRun
FALSEnever evaluated
0-66029
349-
350 runnable->run();-
351-
352 if (del) {
delDescription
TRUEevaluated 66029 times by 3 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentRun
FALSEnever evaluated
0-66029
353 delete runnable;-
354 }
executed 66029 times by 3 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentRun
66029
355}
executed 66029 times by 3 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentRun
66029
356-
357/*!-
358 \class QThreadPool-
359 \inmodule QtCore-
360 \brief The QThreadPool class manages a collection of QThreads.-
361 \since 4.4-
362 \threadsafe-
363-
364 \ingroup thread-
365-
366 QThreadPool manages and recyles individual QThread objects to help reduce-
367 thread creation costs in programs that use threads. Each Qt application-
368 has one global QThreadPool object, which can be accessed by calling-
369 globalInstance().-
370-
371 To use one of the QThreadPool threads, subclass QRunnable and implement-
372 the run() virtual function. Then create an object of that class and pass-
373 it to QThreadPool::start().-
374-
375 \snippet code/src_corelib_concurrent_qthreadpool.cpp 0-
376-
377 QThreadPool deletes the QRunnable automatically by default. Use-
378 QRunnable::setAutoDelete() to change the auto-deletion flag.-
379-
380 QThreadPool supports executing the same QRunnable more than once-
381 by calling tryStart(this) from within QRunnable::run().-
382 If autoDelete is enabled the QRunnable will be deleted when-
383 the last thread exits the run function. Calling start()-
384 multiple times with the same QRunnable when autoDelete is enabled-
385 creates a race condition and is not recommended.-
386-
387 Threads that are unused for a certain amount of time will expire. The-
388 default expiry timeout is 30000 milliseconds (30 seconds). This can be-
389 changed using setExpiryTimeout(). Setting a negative expiry timeout-
390 disables the expiry mechanism.-
391-
392 Call maxThreadCount() to query the maximum number of threads to be used.-
393 If needed, you can change the limit with setMaxThreadCount(). The default-
394 maxThreadCount() is QThread::idealThreadCount(). The activeThreadCount()-
395 function returns the number of threads currently doing work.-
396-
397 The reserveThread() function reserves a thread for external-
398 use. Use releaseThread() when your are done with the thread, so-
399 that it may be reused. Essentially, these functions temporarily-
400 increase or reduce the active thread count and are useful when-
401 implementing time-consuming operations that are not visible to the-
402 QThreadPool.-
403-
404 Note that QThreadPool is a low-level class for managing threads, see-
405 the Qt Concurrent module for higher level alternatives.-
406-
407 \sa QRunnable-
408*/-
409-
410/*!-
411 Constructs a thread pool with the given \a parent.-
412*/-
413QThreadPool::QThreadPool(QObject *parent)-
414 : QObject(*new QThreadPoolPrivate, parent)-
415{
executed 1660 times by 445 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • ...
}
executed 1660 times by 445 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • ...
1660
416-
417/*!-
418 Destroys the QThreadPool.-
419 This function will block until all runnables have been completed.-
420*/-
421QThreadPool::~QThreadPool()-
422{-
423 waitForDone();-
424}
executed 1661 times by 424 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QPointer
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • ...
1661
425-
426/*!-
427 Returns the global QThreadPool instance.-
428*/-
429QThreadPool *QThreadPool::globalInstance()-
430{-
431 return theInstance();
executed 1461081 times by 434 tests: return theInstance();
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QSql
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_compiler - unknown status
  • ...
1461081
432}-
433-
434/*!-
435 Reserves a thread and uses it to run \a runnable, unless this thread will-
436 make the current thread count exceed maxThreadCount(). In that case,-
437 \a runnable is added to a run queue instead. The \a priority argument can-
438 be used to control the run queue's order of execution.-
439-
440 Note that the thread pool takes ownership of the \a runnable if-
441 \l{QRunnable::autoDelete()}{runnable->autoDelete()} returns \c true,-
442 and the \a runnable will be deleted automatically by the thread-
443 pool after the \l{QRunnable::run()}{runnable->run()} returns. If-
444 \l{QRunnable::autoDelete()}{runnable->autoDelete()} returns \c false,-
445 ownership of \a runnable remains with the caller. Note that-
446 changing the auto-deletion on \a runnable after calling this-
447 functions results in undefined behavior.-
448*/-
449void QThreadPool::start(QRunnable *runnable, int priority)-
450{-
451 if (!runnable)
!runnableDescription
TRUEnever evaluated
FALSEevaluated 2475706 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
0-2475706
452 return;
never executed: return;
0
453-
454 Q_D(QThreadPool);-
455 QMutexLocker locker(&d->mutex);-
456 if (!d->tryStart(runnable)) {
!d->tryStart(runnable)Description
TRUEevaluated 302032 times by 10 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 2173674 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
302032-2173674
457 d->enqueueTask(runnable, priority);-
458-
459 if (!d->waitingThreads.isEmpty())
!d->waitingThreads.isEmpty()Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentRun
FALSEevaluated 302028 times by 10 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
4-302028
460 d->waitingThreads.takeFirst()->runnableReady.wakeOne();
executed 4 times by 2 tests: d->waitingThreads.takeFirst()->runnableReady.wakeOne();
Executed by:
  • tst_QThreadPool
  • tst_QtConcurrentRun
4
461 }
executed 302032 times by 10 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QPointer
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
302032
462}
executed 2475706 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextCodec
  • ...
2475706
463-
464/*!-
465 Attempts to reserve a thread to run \a runnable.-
466-
467 If no threads are available at the time of calling, then this function-
468 does nothing and returns \c false. Otherwise, \a runnable is run immediately-
469 using one available thread and this function returns \c true.-
470-
471 Note that the thread pool takes ownership of the \a runnable if-
472 \l{QRunnable::autoDelete()}{runnable->autoDelete()} returns \c true,-
473 and the \a runnable will be deleted automatically by the thread-
474 pool after the \l{QRunnable::run()}{runnable->run()} returns. If-
475 \l{QRunnable::autoDelete()}{runnable->autoDelete()} returns \c false,-
476 ownership of \a runnable remains with the caller. Note that-
477 changing the auto-deletion on \a runnable after calling this-
478 function results in undefined behavior.-
479*/-
480bool QThreadPool::tryStart(QRunnable *runnable)-
481{-
482 if (!runnable)
!runnableDescription
TRUEnever evaluated
FALSEevaluated 80506 times by 6 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
0-80506
483 return false;
never executed: return false;
0
484-
485 Q_D(QThreadPool);-
486-
487 QMutexLocker locker(&d->mutex);-
488-
489 if (d->allThreads.isEmpty() == false && d->activeThreadCount() >= d->maxThreadCount)
d->allThreads....pty() == falseDescription
TRUEevaluated 80502 times by 6 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentThreadEngine
d->activeThrea...maxThreadCountDescription
TRUEevaluated 80261 times by 6 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 241 times by 5 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
4-80502
490 return false;
executed 80261 times by 6 tests: return false;
Executed by:
  • tst_QFutureWatcher
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
80261
491-
492 return d->tryStart(runnable);
executed 245 times by 5 tests: return d->tryStart(runnable);
Executed by:
  • tst_QThreadPool
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
245
493}-
494-
495/*! \property QThreadPool::expiryTimeout-
496-
497 Threads that are unused for \a expiryTimeout milliseconds are considered-
498 to have expired and will exit. Such threads will be restarted as needed.-
499 The default \a expiryTimeout is 30000 milliseconds (30 seconds). If-
500 \a expiryTimeout is negative, newly created threads will not expire, e.g.,-
501 they will not exit until the thread pool is destroyed.-
502-
503 Note that setting \a expiryTimeout has no effect on already running-
504 threads. Only newly created threads will use the new \a expiryTimeout.-
505 We recommend setting the \a expiryTimeout immediately after creating the-
506 thread pool, but before calling start().-
507*/-
508-
509int QThreadPool::expiryTimeout() const-
510{-
511 Q_D(const QThreadPool);-
512 return d->expiryTimeout;
executed 3 times by 1 test: return d->expiryTimeout;
Executed by:
  • tst_QThreadPool
3
513}-
514-
515void QThreadPool::setExpiryTimeout(int expiryTimeout)-
516{-
517 Q_D(QThreadPool);-
518 if (d->expiryTimeout == expiryTimeout)
d->expiryTimeo... expiryTimeoutDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QThreadPool
0-3
519 return;
never executed: return;
0
520 d->expiryTimeout = expiryTimeout;-
521}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QThreadPool
3
522-
523/*! \property QThreadPool::maxThreadCount-
524-
525 This property represents the maximum number of threads used by the thread-
526 pool.-
527-
528 \note The thread pool will always use at least 1 thread, even if-
529 \a maxThreadCount limit is zero or negative.-
530-
531 The default \a maxThreadCount is QThread::idealThreadCount().-
532*/-
533-
534int QThreadPool::maxThreadCount() const-
535{-
536 Q_D(const QThreadPool);-
537 return d->maxThreadCount;
executed 22110 times by 24 tests: return d->maxThreadCount;
Executed by:
  • tst_Lancelot
  • tst_QFtp
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QThreadPool
  • tst_QUdpSocket
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
  • tst_Spdy
22110
538}-
539-
540void QThreadPool::setMaxThreadCount(int maxThreadCount)-
541{-
542 Q_D(QThreadPool);-
543 QMutexLocker locker(&d->mutex);-
544-
545 if (maxThreadCount == d->maxThreadCount)
maxThreadCount...maxThreadCountDescription
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QThreadPool
  • tst_QtConcurrentRun
FALSEevaluated 137 times by 31 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QObject
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTextCodec
  • ...
20-137
546 return;
executed 20 times by 2 tests: return;
Executed by:
  • tst_QThreadPool
  • tst_QtConcurrentRun
20
547-
548 d->maxThreadCount = maxThreadCount;-
549 d->tryToStartMoreThreads();-
550}
executed 137 times by 31 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QObject
  • tst_QProcess
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTextCodec
  • ...
137
551-
552/*! \property QThreadPool::activeThreadCount-
553-
554 This property represents the number of active threads in the thread pool.-
555-
556 \note It is possible for this function to return a value that is greater-
557 than maxThreadCount(). See reserveThread() for more details.-
558-
559 \sa reserveThread(), releaseThread()-
560*/-
561-
562int QThreadPool::activeThreadCount() const-
563{-
564 Q_D(const QThreadPool);-
565 QMutexLocker locker(&d->mutex);-
566 return d->activeThreadCount();
executed 49824 times by 1 test: return d->activeThreadCount();
Executed by:
  • tst_QThreadPool
49824
567}-
568-
569/*!-
570 Reserves one thread, disregarding activeThreadCount() and maxThreadCount().-
571-
572 Once you are done with the thread, call releaseThread() to allow it to be-
573 reused.-
574-
575 \note This function will always increase the number of active threads.-
576 This means that by using this function, it is possible for-
577 activeThreadCount() to return a value greater than maxThreadCount() .-
578-
579 \sa releaseThread()-
580 */-
581void QThreadPool::reserveThread()-
582{-
583 Q_D(QThreadPool);-
584 QMutexLocker locker(&d->mutex);-
585 ++d->reservedThreads;-
586}
executed 49665 times by 1 test: end of block
Executed by:
  • tst_QThreadPool
49665
587-
588/*!-
589 Releases a thread previously reserved by a call to reserveThread().-
590-
591 \note Calling this function without previously reserving a thread-
592 temporarily increases maxThreadCount(). This is useful when a-
593 thread goes to sleep waiting for more work, allowing other threads-
594 to continue. Be sure to call reserveThread() when done waiting, so-
595 that the thread pool can correctly maintain the-
596 activeThreadCount().-
597-
598 \sa reserveThread()-
599*/-
600void QThreadPool::releaseThread()-
601{-
602 Q_D(QThreadPool);-
603 QMutexLocker locker(&d->mutex);-
604 --d->reservedThreads;-
605 d->tryToStartMoreThreads();-
606}
executed 49665 times by 1 test: end of block
Executed by:
  • tst_QThreadPool
49665
607-
608/*!-
609 Waits up to \a msecs milliseconds for all threads to exit and removes all-
610 threads from the thread pool. Returns \c true if all threads were removed;-
611 otherwise it returns \c false. If \a msecs is -1 (the default), the timeout-
612 is ignored (waits for the last thread to exit).-
613*/-
614bool QThreadPool::waitForDone(int msecs)-
615{-
616 Q_D(QThreadPool);-
617 bool rc = d->waitForDone(msecs);-
618 if (rc)
rcDescription
TRUEevaluated 4369 times by 441 tests
Evaluated by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QThreadPool
2-4369
619 d->reset();
executed 4369 times by 441 tests: d->reset();
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
4369
620 return rc;
executed 4371 times by 441 tests: return rc;
Executed by:
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDnsLookup_Appless
  • tst_QFuture
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QNetworkConfigurationManager
  • tst_QPointer
  • tst_QSql
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpSocket
  • tst_QTextCodec
  • tst_QThreadPool
  • tst_QtConcurrentRun
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • ...
4371
621}-
622-
623/*!-
624 \since 5.2-
625-
626 Removes the runnables that are not yet started from the queue.-
627 The runnables for which \l{QRunnable::autoDelete()}{runnable->autoDelete()}-
628 returns \c true are deleted.-
629-
630 \sa start()-
631*/-
632void QThreadPool::clear()-
633{-
634 Q_D(QThreadPool);-
635 d->clear();-
636}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QThreadPool
1
637-
638/*!-
639 \since 5.5-
640-
641 Removes the specified \a runnable from the queue if it is not yet started.-
642 The runnables for which \l{QRunnable::autoDelete()}{runnable->autoDelete()}-
643 returns \c true are deleted.-
644-
645 \sa start()-
646*/-
647void QThreadPool::cancel(QRunnable *runnable)-
648{-
649 Q_D(QThreadPool);-
650 if (!d->stealRunnable(runnable))
!d->stealRunnable(runnable)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QThreadPool
3-9
651 return;
executed 9 times by 1 test: return;
Executed by:
  • tst_QThreadPool
9
652 if (runnable->autoDelete() && !--runnable->ref) {
runnable->autoDelete()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QThreadPool
!--runnable->refDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThreadPool
FALSEnever evaluated
0-2
653 delete runnable;-
654 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QThreadPool
2
655}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QThreadPool
3
656-
657QT_END_NAMESPACE-
658-
659#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9