qfutureinterface.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/thread/qfutureinterface.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// qfutureinterface.h included from qfuture.h-
41#include "qfuture.h"-
42-
43#ifndef QT_NO_QFUTURE-
44-
45#include "qfutureinterface_p.h"-
46-
47#include <QtCore/qatomic.h>-
48#include <QtCore/qthread.h>-
49#include <private/qthreadpool_p.h>-
50-
51QT_BEGIN_NAMESPACE-
52-
53enum {-
54 MaxProgressEmitsPerSecond = 25-
55};-
56-
57namespace {-
58class ThreadPoolThreadReleaser {-
59 QThreadPool *m_pool;-
60public:-
61 explicit ThreadPoolThreadReleaser(QThreadPool *pool)-
62 : m_pool(pool)-
63 { if (pool) pool->releaseThread(); }
never executed: end of block
never executed: pool->releaseThread();
poolDescription
TRUEnever evaluated
FALSEnever evaluated
0
64 ~ThreadPoolThreadReleaser()-
65 { if (m_pool) m_pool->reserveThread(); }
never executed: end of block
never executed: m_pool->reserveThread();
m_poolDescription
TRUEnever evaluated
FALSEnever evaluated
0
66};-
67} // unnamed namespace-
68-
69-
70QFutureInterfaceBase::QFutureInterfaceBase(State initialState)-
71 : d(new QFutureInterfaceBasePrivate(initialState))-
72{
executed 128690 times by 12 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
}
executed 128690 times by 12 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128690
73-
74QFutureInterfaceBase::QFutureInterfaceBase(const QFutureInterfaceBase &other)-
75 : d(other.d)-
76{-
77 d->refCount.ref();-
78}
executed 160412 times by 12 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
160412
79-
80QFutureInterfaceBase::~QFutureInterfaceBase()-
81{-
82 if (!d->refCount.deref())
!d->refCount.deref()Description
TRUEevaluated 128616 times by 14 tests
Evaluated by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_qdebug - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
FALSEevaluated 160486 times by 12 tests
Evaluated by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128616-160486
83 delete d;
executed 128616 times by 14 tests: delete d;
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_qdebug - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
128616
84}
executed 289102 times by 14 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_qdebug - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
289102
85-
86static inline int switch_on(QAtomicInt &a, int which)-
87{-
88 return a.fetchAndOrRelaxed(which) | which;
executed 38 times by 5 tests: return a.fetchAndOrRelaxed(which) | which;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
38
89}-
90-
91static inline int switch_off(QAtomicInt &a, int which)-
92{-
93 return a.fetchAndAndRelaxed(~which) & ~which;
executed 26 times by 2 tests: return a.fetchAndAndRelaxed(~which) & ~which;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
26
94}-
95-
96static inline int switch_from_to(QAtomicInt &a, int from, int to)-
97{-
98 int newValue;-
99 int expected = a.load();-
100 do {-
101 newValue = (expected & ~from) | to;-
102 } while (!a.testAndSetRelaxed(expected, newValue, expected));
executed 129440 times by 11 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
!a.testAndSetR...lue, expected)Description
TRUEnever evaluated
FALSEevaluated 129440 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
0-129440
103 return newValue;
executed 129440 times by 11 tests: return newValue;
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
129440
104}-
105-
106void QFutureInterfaceBase::cancel()-
107{-
108 QMutexLocker locker(&d->m_mutex);-
109 if (d->state.load() & Canceled)
d->state.load() & CanceledDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 1112 times by 4 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentThreadEngine
5-1112
110 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QFutureWatcher
5
111-
112 switch_from_to(d->state, Paused, Canceled);-
113 d->waitCondition.wakeAll();-
114 d->pausedWaitCondition.wakeAll();-
115 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));-
116}
executed 1112 times by 4 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentThreadEngine
1112
117-
118void QFutureInterfaceBase::setPaused(bool paused)-
119{-
120 QMutexLocker locker(&d->m_mutex);-
121 if (paused) {
pausedDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
9
122 switch_on(d->state, Paused);-
123 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused));-
124 } else {
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
9
125 switch_off(d->state, Paused);-
126 d->pausedWaitCondition.wakeAll();-
127 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed));-
128 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
9
129}-
130-
131void QFutureInterfaceBase::togglePaused()-
132{-
133 QMutexLocker locker(&d->m_mutex);-
134 if (d->state.load() & Paused) {
d->state.load() & PausedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFuture
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
1-7
135 switch_off(d->state, Paused);-
136 d->pausedWaitCondition.wakeAll();-
137 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed));-
138 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QFuture
1
139 switch_on(d->state, Paused);-
140 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused));-
141 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
7
142}-
143-
144void QFutureInterfaceBase::setThrottled(bool enable)-
145{-
146 QMutexLocker lock(&d->m_mutex);-
147 if (enable) {
enableDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFuture
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
2-16
148 switch_on(d->state, Throttled);-
149 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_QFuture
2
150 switch_off(d->state, Throttled);-
151 if (!(d->state.load() & Paused))
!(d->state.load() & Paused)Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
FALSEnever evaluated
0-16
152 d->pausedWaitCondition.wakeAll();
executed 16 times by 2 tests: d->pausedWaitCondition.wakeAll();
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
16
153 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
16
154}-
155-
156-
157bool QFutureInterfaceBase::isRunning() const-
158{-
159 return queryState(Running);
executed 322807 times by 12 tests: return queryState(Running);
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
322807
160}-
161-
162bool QFutureInterfaceBase::isStarted() const-
163{-
164 return queryState(Started);
executed 28 times by 2 tests: return queryState(Started);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
28
165}-
166-
167bool QFutureInterfaceBase::isCanceled() const-
168{-
169 return queryState(Canceled);
executed 202250 times by 11 tests: return queryState(Canceled);
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
202250
170}-
171-
172bool QFutureInterfaceBase::isFinished() const-
173{-
174 return queryState(Finished);
executed 128856 times by 12 tests: return queryState(Finished);
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128856
175}-
176-
177bool QFutureInterfaceBase::isPaused() const-
178{-
179 return queryState(Paused);
executed 13517 times by 6 tests: return queryState(Paused);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
13517
180}-
181-
182bool QFutureInterfaceBase::isThrottled() const-
183{-
184 return queryState(Throttled);
executed 7 times by 2 tests: return queryState(Throttled);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
7
185}-
186-
187bool QFutureInterfaceBase::isResultReadyAt(int index) const-
188{-
189 QMutexLocker lock(&d->m_mutex);-
190 return d->internal_isResultReadyAt(index);
executed 15004 times by 2 tests: return d->internal_isResultReadyAt(index);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
15004
191}-
192-
193bool QFutureInterfaceBase::waitForNextResult()-
194{-
195 QMutexLocker lock(&d->m_mutex);-
196 return d->internal_waitForNextResult();
never executed: return d->internal_waitForNextResult();
0
197}-
198-
199void QFutureInterfaceBase::waitForResume()-
200{-
201 // return early if possible to avoid taking the mutex lock.-
202 {-
203 const int state = d->state.load();-
204 if (!(state & Paused) || (state & Canceled))
!(state & Paused)Description
TRUEevaluated 6309 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
FALSEnever evaluated
(state & Canceled)Description
TRUEnever evaluated
FALSEnever evaluated
0-6309
205 return;
executed 6309 times by 4 tests: return;
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
6309
206 }-
207-
208 QMutexLocker lock(&d->m_mutex);-
209 const int state = d->state.load();-
210 if (!(state & Paused) || (state & Canceled))
!(state & Paused)Description
TRUEnever evaluated
FALSEnever evaluated
(state & Canceled)Description
TRUEnever evaluated
FALSEnever evaluated
0
211 return;
never executed: return;
0
212-
213 // decrease active thread count since this thread will wait.-
214 const ThreadPoolThreadReleaser releaser(d->pool());-
215-
216 d->pausedWaitCondition.wait(&d->m_mutex);-
217}
never executed: end of block
0
218-
219int QFutureInterfaceBase::progressValue() const-
220{-
221 const QMutexLocker lock(&d->m_mutex);-
222 return d->m_progressValue;
executed 17 times by 2 tests: return d->m_progressValue;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
17
223}-
224-
225int QFutureInterfaceBase::progressMinimum() const-
226{-
227 const QMutexLocker lock(&d->m_mutex);-
228 return d->m_progressMinimum;
executed 12 times by 1 test: return d->m_progressMinimum;
Executed by:
  • tst_QFutureWatcher
12
229}-
230-
231int QFutureInterfaceBase::progressMaximum() const-
232{-
233 const QMutexLocker lock(&d->m_mutex);-
234 return d->m_progressMaximum;
executed 12 times by 1 test: return d->m_progressMaximum;
Executed by:
  • tst_QFutureWatcher
12
235}-
236-
237int QFutureInterfaceBase::resultCount() const-
238{-
239 QMutexLocker lock(&d->m_mutex);-
240 return d->internal_resultCount();
executed 28711 times by 3 tests: return d->internal_resultCount();
Executed by:
  • tst_QFuture
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
28711
241}-
242-
243QString QFutureInterfaceBase::progressText() const-
244{-
245 QMutexLocker locker(&d->m_mutex);-
246 return d->m_progressText;
executed 15 times by 2 tests: return d->m_progressText;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
15
247}-
248-
249bool QFutureInterfaceBase::isProgressUpdateNeeded() const-
250{-
251 QMutexLocker locker(&d->m_mutex);-
252 return !d->progressTime.isValid() || (d->progressTime.elapsed() > (1000 / MaxProgressEmitsPerSecond));
executed 107 times by 1 test: return !d->progressTime.isValid() || (d->progressTime.elapsed() > (1000 / MaxProgressEmitsPerSecond));
Executed by:
  • tst_QFutureWatcher
107
253}-
254-
255void QFutureInterfaceBase::reportStarted()-
256{-
257 QMutexLocker locker(&d->m_mutex);-
258 if (d->state.load() & (Started|Canceled|Finished))
d->state.load(...eled|Finished)Description
TRUEnever evaluated
FALSEevaluated 128329 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
0-128329
259 return;
never executed: return;
0
260-
261 d->setState(State(Started | Running));-
262 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Started));-
263}
executed 128329 times by 11 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128329
264-
265void QFutureInterfaceBase::reportCanceled()-
266{-
267 cancel();-
268}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QFuture
3
269-
270#ifndef QT_NO_EXCEPTIONS-
271void QFutureInterfaceBase::reportException(const QException &exception)-
272{-
273 QMutexLocker locker(&d->m_mutex);-
274 if (d->state.load() & (Canceled|Finished))
d->state.load(...eled|Finished)Description
TRUEnever evaluated
FALSEevaluated 17 times by 4 tests
Evaluated by:
  • tst_QFuture
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
0-17
275 return;
never executed: return;
0
276-
277 d->m_exceptionStore.setException(exception);-
278 switch_on(d->state, Canceled);-
279 d->waitCondition.wakeAll();-
280 d->pausedWaitCondition.wakeAll();-
281 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));-
282}
executed 17 times by 4 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
17
283#endif-
284-
285void QFutureInterfaceBase::reportFinished()-
286{-
287 QMutexLocker locker(&d->m_mutex);-
288 if (!isFinished()) {
!isFinished()Description
TRUEevaluated 128328 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
FALSEnever evaluated
0-128328
289 switch_from_to(d->state, Running, Finished);-
290 d->waitCondition.wakeAll();-
291 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Finished));-
292 }
executed 128328 times by 11 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128328
293}
executed 128328 times by 11 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128328
294-
295void QFutureInterfaceBase::setExpectedResultCount(int resultCount)-
296{-
297 if (d->manualProgress == false)
d->manualProgress == falseDescription
TRUEnever evaluated
FALSEnever evaluated
0
298 setProgressRange(0, resultCount);
never executed: setProgressRange(0, resultCount);
0
299 d->m_expectedResultCount = resultCount;-
300}
never executed: end of block
0
301-
302int QFutureInterfaceBase::expectedResultCount()-
303{-
304 return d->m_expectedResultCount;
never executed: return d->m_expectedResultCount;
0
305}-
306-
307bool QFutureInterfaceBase::queryState(State state) const-
308{-
309 return d->state.load() & state;
executed 737258 times by 12 tests: return d->state.load() & state;
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
737258
310}-
311-
312void QFutureInterfaceBase::waitForResult(int resultIndex)-
313{-
314 d->m_exceptionStore.throwPossibleException();-
315-
316 QMutexLocker lock(&d->m_mutex);-
317 if (!isRunning())
!isRunning()Description
TRUEevaluated 15527 times by 7 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 60802 times by 7 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
15527-60802
318 return;
executed 15527 times by 7 tests: return;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
15527
319 lock.unlock();-
320-
321 // To avoid deadlocks and reduce the number of threads used, try to-
322 // run the runnable in the current thread.-
323 d->pool()->d_func()->stealAndRunRunnable(d->runnable);-
324-
325 lock.relock();-
326-
327 const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex;
(resultIndex == -1)Description
TRUEevaluated 86 times by 4 tests
Evaluated by:
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 60716 times by 6 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
86-60716
328 while (isRunning() && !d->internal_isResultReadyAt(waitIndex))
isRunning()Description
TRUEevaluated 28384 times by 7 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 32891 times by 6 tests
Evaluated by:
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
!d->internal_i...yAt(waitIndex)Description
TRUEevaluated 473 times by 6 tests
Evaluated by:
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 27911 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
473-32891
329 d->waitCondition.wait(&d->m_mutex);
executed 473 times by 6 tests: d->waitCondition.wait(&d->m_mutex);
Executed by:
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
473
330-
331 d->m_exceptionStore.throwPossibleException();-
332}
executed 60800 times by 7 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
60800
333-
334void QFutureInterfaceBase::waitForFinished()-
335{-
336 QMutexLocker lock(&d->m_mutex);-
337 const bool alreadyFinished = !isRunning();-
338 lock.unlock();-
339-
340 if (!alreadyFinished) {
!alreadyFinishedDescription
TRUEevaluated 71411 times by 9 tests
Evaluated by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 4253 times by 10 tests
Evaluated by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
4253-71411
341 d->pool()->d_func()->stealAndRunRunnable(d->runnable);-
342-
343 lock.relock();-
344-
345 while (isRunning())
isRunning()Description
TRUEevaluated 38070 times by 9 tests
Evaluated by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 71411 times by 9 tests
Evaluated by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
38070-71411
346 d->waitCondition.wait(&d->m_mutex);
executed 38070 times by 9 tests: d->waitCondition.wait(&d->m_mutex);
Executed by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
38070
347 }
executed 71411 times by 9 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
71411
348-
349 d->m_exceptionStore.throwPossibleException();-
350}
executed 75653 times by 11 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
75653
351-
352void QFutureInterfaceBase::reportResultsReady(int beginIndex, int endIndex)-
353{-
354 if (beginIndex == endIndex || (d->state.load() & (Canceled|Finished)))
beginIndex == endIndexDescription
TRUEevaluated 53 times by 2 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
FALSEevaluated 34826 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
(d->state.load...led|Finished))Description
TRUEnever evaluated
FALSEevaluated 34826 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
0-34826
355 return;
executed 53 times by 2 tests: return;
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
53
356-
357 d->waitCondition.wakeAll();-
358-
359 if (d->manualProgress == false) {
d->manualProgress == falseDescription
TRUEevaluated 34114 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 712 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
712-34114
360 if (d->internal_updateProgress(d->m_progressValue + endIndex - beginIndex) == false) {
d->internal_up...ndex) == falseDescription
TRUEevaluated 1119 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 32995 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
1119-32995
361 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady,-
362 beginIndex,-
363 endIndex));-
364 return;
executed 1119 times by 5 tests: return;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
1119
365 }-
366-
367 d->sendCallOuts(QFutureCallOutEvent(QFutureCallOutEvent::Progress,-
368 d->m_progressValue,-
369 d->m_progressText),-
370 QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady,-
371 beginIndex,-
372 endIndex));-
373 return;
executed 32995 times by 8 tests: return;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
32995
374 }-
375 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady, beginIndex, endIndex));-
376}
executed 712 times by 4 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
712
377-
378void QFutureInterfaceBase::setRunnable(QRunnable *runnable)-
379{-
380 d->runnable = runnable;-
381}
executed 67765 times by 7 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentRun
67765
382-
383void QFutureInterfaceBase::setThreadPool(QThreadPool *pool)-
384{-
385 d->m_pool = pool;-
386}
executed 67765 times by 7 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentRun
67765
387-
388void QFutureInterfaceBase::setFilterMode(bool enable)-
389{-
390 QMutexLocker locker(&d->m_mutex);-
391 resultStoreBase().setFilterMode(enable);-
392}
executed 34 times by 2 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
34
393-
394void QFutureInterfaceBase::setProgressRange(int minimum, int maximum)-
395{-
396 QMutexLocker locker(&d->m_mutex);-
397 d->m_progressMinimum = minimum;-
398 d->m_progressMaximum = maximum;-
399 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange, minimum, maximum));-
400}
executed 260 times by 4 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
260
401-
402void QFutureInterfaceBase::setProgressValue(int progressValue)-
403{-
404 setProgressValueAndText(progressValue, QString());-
405}
executed 105907 times by 5 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
105907
406-
407void QFutureInterfaceBase::setProgressValueAndText(int progressValue,-
408 const QString &progressText)-
409{-
410 QMutexLocker locker(&d->m_mutex);-
411 if (d->manualProgress == false)
d->manualProgress == falseDescription
TRUEevaluated 261 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
FALSEevaluated 105651 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
261-105651
412 d->manualProgress = true;
executed 261 times by 5 tests: d->manualProgress = true;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
261
413 if (d->m_progressValue >= progressValue)
d->m_progressV... progressValueDescription
TRUEevaluated 48 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
FALSEevaluated 105864 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
48-105864
414 return;
executed 48 times by 4 tests: return;
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
48
415-
416 if (d->state.load() & (Canceled|Finished))
d->state.load(...eled|Finished)Description
TRUEnever evaluated
FALSEevaluated 105864 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
0-105864
417 return;
never executed: return;
0
418-
419 if (d->internal_updateProgress(progressValue, progressText)) {
d->internal_up... progressText)Description
TRUEevaluated 524 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
FALSEevaluated 105340 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
524-105340
420 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Progress,-
421 d->m_progressValue,-
422 d->m_progressText));-
423 }
executed 524 times by 5 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
524
424}
executed 105864 times by 5 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
105864
425-
426QMutex *QFutureInterfaceBase::mutex() const-
427{-
428 return &d->m_mutex;
executed 111280 times by 8 tests: return &d->m_mutex;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
111280
429}-
430-
431QtPrivate::ExceptionStore &QFutureInterfaceBase::exceptionStore()-
432{-
433 return d->m_exceptionStore;
executed 3 times by 1 test: return d->m_exceptionStore;
Executed by:
  • tst_QFuture
3
434}-
435-
436QtPrivate::ResultStoreBase &QFutureInterfaceBase::resultStoreBase()-
437{-
438 return d->m_results;
executed 68791 times by 9 tests: return d->m_results;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_qtconcurrentiteratekernel - unknown status
68791
439}-
440-
441const QtPrivate::ResultStoreBase &QFutureInterfaceBase::resultStoreBase() const-
442{-
443 return d->m_results;
executed 76299 times by 8 tests: return d->m_results;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
76299
444}-
445-
446QFutureInterfaceBase &QFutureInterfaceBase::operator=(const QFutureInterfaceBase &other)-
447{-
448 other.d->refCount.ref();-
449 if (!d->refCount.deref())
!d->refCount.deref()Description
TRUEevaluated 74 times by 4 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentRun
26-74
450 delete d;
executed 74 times by 4 tests: delete d;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
74
451 d = other.d;-
452 return *this;
executed 100 times by 4 tests: return *this;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
100
453}-
454-
455bool QFutureInterfaceBase::refT() const-
456{-
457 return d->refCount.refT();
executed 96297 times by 8 tests: return d->refCount.refT();
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
96297
458}-
459-
460bool QFutureInterfaceBase::derefT() const-
461{-
462 return d->refCount.derefT();
executed 96297 times by 9 tests: return d->refCount.derefT();
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
  • tst_qtconcurrentiteratekernel - unknown status
96297
463}-
464-
465QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)-
466 : refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0),-
467 state(initialState),-
468 manualProgress(false), m_expectedResultCount(0), runnable(0), m_pool(0)-
469{-
470 progressTime.invalidate();-
471}
executed 128690 times by 12 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureSynchronizer
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128690
472-
473int QFutureInterfaceBasePrivate::internal_resultCount() const-
474{-
475 return m_results.count(); // ### subtract canceled results.
executed 28711 times by 3 tests: return m_results.count();
Executed by:
  • tst_QFuture
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
28711
476}-
477-
478bool QFutureInterfaceBasePrivate::internal_isResultReadyAt(int index) const-
479{-
480 return (m_results.contains(index));
executed 43388 times by 8 tests: return (m_results.contains(index));
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
43388
481}-
482-
483bool QFutureInterfaceBasePrivate::internal_waitForNextResult()-
484{-
485 if (m_results.hasNextResult())
m_results.hasNextResult()Description
TRUEnever evaluated
FALSEnever evaluated
0
486 return true;
never executed: return true;
0
487-
488 while ((state.load() & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false)
(state.load() ...Base::Running)Description
TRUEnever evaluated
FALSEnever evaluated
m_results.hasN...ult() == falseDescription
TRUEnever evaluated
FALSEnever evaluated
0
489 waitCondition.wait(&m_mutex);
never executed: waitCondition.wait(&m_mutex);
0
490-
491 return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult();
never executed: return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult();
0
492}-
493-
494bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress,-
495 const QString &progressText)-
496{-
497 if (m_progressValue >= progress)
m_progressValue >= progressDescription
TRUEnever evaluated
FALSEevaluated 139978 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
0-139978
498 return false;
never executed: return false;
0
499-
500 m_progressValue = progress;-
501 m_progressText = progressText;-
502-
503 if (progressTime.isValid() && m_progressValue != m_progressMaximum) // make sure the first and last steps are emitted.
progressTime.isValid()Description
TRUEevaluated 106769 times by 6 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 33209 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
m_progressValu...rogressMaximumDescription
TRUEevaluated 106522 times by 6 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 247 times by 4 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
247-106769
504 if (progressTime.elapsed() < (1000 / MaxProgressEmitsPerSecond))
progressTime.e...mitsPerSecond)Description
TRUEevaluated 106459 times by 6 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
63-106459
505 return false;
executed 106459 times by 6 tests: return false;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
106459
506-
507 progressTime.start();-
508 return true;
executed 33519 times by 8 tests: return true;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
33519
509}-
510-
511void QFutureInterfaceBasePrivate::internal_setThrottled(bool enable)-
512{-
513 // bail out if we are not changing the state-
514 if ((enable && (state.load() & QFutureInterfaceBase::Throttled))
enableDescription
TRUEevaluated 1164 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEnever evaluated
(state.load() ...se::Throttled)Description
TRUEevaluated 1161 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
0-1164
515 || (!enable && !(state.load() & QFutureInterfaceBase::Throttled)))
!enableDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
!(state.load()...se::Throttled)Description
TRUEnever evaluated
FALSEnever evaluated
0-3
516 return;
executed 1161 times by 1 test: return;
Executed by:
  • tst_QFutureWatcher
1161
517-
518 // change the state-
519 if (enable) {
enableDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEnever evaluated
0-3
520 switch_on(state, QFutureInterfaceBase::Throttled);-
521 } else {
executed 3 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
3
522 switch_off(state, QFutureInterfaceBase::Throttled);-
523 if (!(state.load() & QFutureInterfaceBase::Paused))
!(state.load()...eBase::Paused)Description
TRUEnever evaluated
FALSEnever evaluated
0
524 pausedWaitCondition.wakeAll();
never executed: pausedWaitCondition.wakeAll();
0
525 }
never executed: end of block
0
526}-
527-
528void QFutureInterfaceBasePrivate::sendCallOut(const QFutureCallOutEvent &callOutEvent)-
529{-
530 if (outputConnections.isEmpty())
outputConnections.isEmpty()Description
TRUEevaluated 259374 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 1053 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
1053-259374
531 return;
executed 259374 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
259374
532-
533 for (int i = 0; i < outputConnections.count(); ++i)
i < outputConnections.count()Description
TRUEevaluated 1053 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 1053 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
1053
534 outputConnections.at(i)->postCallOutEvent(callOutEvent);
executed 1053 times by 1 test: outputConnections.at(i)->postCallOutEvent(callOutEvent);
Executed by:
  • tst_QFutureWatcher
1053
535}
executed 1053 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
1053
536-
537void QFutureInterfaceBasePrivate::sendCallOuts(const QFutureCallOutEvent &callOutEvent1,-
538 const QFutureCallOutEvent &callOutEvent2)-
539{-
540 if (outputConnections.isEmpty())
outputConnections.isEmpty()Description
TRUEevaluated 32989 times by 8 tests
Evaluated by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
6-32989
541 return;
executed 32989 times by 8 tests: return;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
32989
542-
543 for (int i = 0; i < outputConnections.count(); ++i) {
i < outputConnections.count()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
6
544 QFutureCallOutInterface *interface = outputConnections.at(i);-
545 interface->postCallOutEvent(callOutEvent1);-
546 interface->postCallOutEvent(callOutEvent2);-
547 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
6
548}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
6
549-
550// This function connects an output interface (for example a QFutureWatcher)-
551// to this future. While holding the lock we check the state and ready results-
552// and add the appropriate callouts to the queue. In order to avoid deadlocks,-
553// the actual callouts are made at the end while not holding the lock.-
554void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface *interface)-
555{-
556 QMutexLocker locker(&m_mutex);-
557-
558 if (state.load() & QFutureInterfaceBase::Started) {
state.load() &...eBase::StartedDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEnever evaluated
0-28
559 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Started));-
560 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange,-
561 m_progressMinimum,-
562 m_progressMaximum));-
563 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Progress,-
564 m_progressValue,-
565 m_progressText));-
566 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
28
567-
568 QtPrivate::ResultIteratorBase it = m_results.begin();-
569 while (it != m_results.end()) {
it != m_results.end()Description
TRUEevaluated 177 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
28-177
570 const int begin = it.resultIndex();-
571 const int end = begin + it.batchSize();-
572 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady,-
573 begin,-
574 end));-
575 it.batchedAdvance();-
576 }
executed 177 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
177
577-
578 if (state.load() & QFutureInterfaceBase::Paused)
state.load() &...ceBase::PausedDescription
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
0-28
579 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused));
never executed: interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused));
0
580-
581 if (state.load() & QFutureInterfaceBase::Canceled)
state.load() &...Base::CanceledDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
5-23
582 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));
executed 5 times by 1 test: interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));
Executed by:
  • tst_QFutureWatcher
5
583-
584 if (state.load() & QFutureInterfaceBase::Finished)
state.load() &...Base::FinishedDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
14
585 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished));
executed 14 times by 1 test: interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished));
Executed by:
  • tst_QFutureWatcher
14
586-
587 outputConnections.append(interface);-
588}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
28
589-
590void QFutureInterfaceBasePrivate::disconnectOutputInterface(QFutureCallOutInterface *interface)-
591{-
592 QMutexLocker lock(&m_mutex);-
593 const int index = outputConnections.indexOf(interface);-
594 if (index == -1)
index == -1Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
23-28
595 return;
executed 23 times by 1 test: return;
Executed by:
  • tst_QFutureWatcher
23
596 outputConnections.removeAt(index);-
597-
598 interface->callOutInterfaceDisconnected();-
599}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
28
600-
601void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState)-
602{-
603 state.store(newState);-
604}
executed 128329 times by 11 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
128329
605-
606QT_END_NAMESPACE-
607-
608#endif // QT_NO_QFUTURE-
Source codeSwitch to Preprocessed file

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