OpenCoverage

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

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