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) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34// qfutureinterface.h included from qfuture.h-
35#include "qfuture.h"-
36-
37#ifndef QT_NO_QFUTURE-
38-
39#include "qfutureinterface_p.h"-
40-
41#include <QtCore/qatomic.h>-
42#include <QtCore/qthread.h>-
43#include <private/qthreadpool_p.h>-
44-
45QT_BEGIN_NAMESPACE-
46-
47enum {-
48 MaxProgressEmitsPerSecond = 25-
49};-
50-
51namespace {-
52class ThreadPoolThreadReleaser {-
53 QThreadPool *m_pool;-
54public:-
55 explicit ThreadPoolThreadReleaser(QThreadPool *pool)-
56 : m_pool(pool)-
57 { if (pool) pool->releaseThread(); }
never executed: end of block
never executed: pool->releaseThread();
poolDescription
TRUEnever evaluated
FALSEnever evaluated
0
58 ~ThreadPoolThreadReleaser()-
59 { if (m_pool) m_pool->reserveThread(); }
never executed: end of block
never executed: m_pool->reserveThread();
m_poolDescription
TRUEnever evaluated
FALSEnever evaluated
0
60};-
61} // unnamed namespace-
62-
63-
64QFutureInterfaceBase::QFutureInterfaceBase(State initialState)-
65 : d(new QFutureInterfaceBasePrivate(initialState))-
66{
executed 128673 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 128673 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
128673
67-
68QFutureInterfaceBase::QFutureInterfaceBase(const QFutureInterfaceBase &other)-
69 : d(other.d)-
70{-
71 d->refCount.ref();-
72}
executed 160391 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
160391
73-
74QFutureInterfaceBase::~QFutureInterfaceBase()-
75{-
76 if (!d->refCount.deref())
!d->refCount.deref()Description
TRUEevaluated 128599 times by 13 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
FALSEevaluated 160465 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
128599-160465
77 delete d;
executed 128599 times by 13 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
128599
78}
executed 289064 times by 13 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
289064
79-
80static inline int switch_on(QAtomicInt &a, int which)-
81{-
82 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
83}-
84-
85static inline int switch_off(QAtomicInt &a, int which)-
86{-
87 return a.fetchAndAndRelaxed(~which) & ~which;
executed 26 times by 2 tests: return a.fetchAndAndRelaxed(~which) & ~which;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
26
88}-
89-
90static inline int switch_from_to(QAtomicInt &a, int from, int to)-
91{-
92 int newValue;-
93 int expected = a.load();-
94 do {-
95 newValue = (expected & ~from) | to;-
96 } while (!a.testAndSetRelaxed(expected, newValue, expected));
executed 129423 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 129423 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-129423
97 return newValue;
executed 129423 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
129423
98}-
99-
100void QFutureInterfaceBase::cancel()-
101{-
102 QMutexLocker locker(&d->m_mutex);-
103 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
104 return;
executed 5 times by 1 test: return;
Executed by:
  • tst_QFutureWatcher
5
105-
106 switch_from_to(d->state, Paused, Canceled);-
107 d->waitCondition.wakeAll();-
108 d->pausedWaitCondition.wakeAll();-
109 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));-
110}
executed 1112 times by 4 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentThreadEngine
1112
111-
112void QFutureInterfaceBase::setPaused(bool paused)-
113{-
114 QMutexLocker locker(&d->m_mutex);-
115 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
116 switch_on(d->state, Paused);-
117 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused));-
118 } else {
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
9
119 switch_off(d->state, Paused);-
120 d->pausedWaitCondition.wakeAll();-
121 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed));-
122 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
9
123}-
124-
125void QFutureInterfaceBase::togglePaused()-
126{-
127 QMutexLocker locker(&d->m_mutex);-
128 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
129 switch_off(d->state, Paused);-
130 d->pausedWaitCondition.wakeAll();-
131 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed));-
132 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QFuture
1
133 switch_on(d->state, Paused);-
134 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused));-
135 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
7
136}-
137-
138void QFutureInterfaceBase::setThrottled(bool enable)-
139{-
140 QMutexLocker lock(&d->m_mutex);-
141 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
142 switch_on(d->state, Throttled);-
143 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_QFuture
2
144 switch_off(d->state, Throttled);-
145 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
146 d->pausedWaitCondition.wakeAll();
executed 16 times by 2 tests: d->pausedWaitCondition.wakeAll();
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
16
147 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
16
148}-
149-
150-
151bool QFutureInterfaceBase::isRunning() const-
152{-
153 return queryState(Running);
executed 323859 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
323859
154}-
155-
156bool QFutureInterfaceBase::isStarted() const-
157{-
158 return queryState(Started);
executed 28 times by 2 tests: return queryState(Started);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
28
159}-
160-
161bool QFutureInterfaceBase::isCanceled() const-
162{-
163 return queryState(Canceled);
executed 202230 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
202230
164}-
165-
166bool QFutureInterfaceBase::isFinished() const-
167{-
168 return queryState(Finished);
executed 128826 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
128826
169}-
170-
171bool QFutureInterfaceBase::isPaused() const-
172{-
173 return queryState(Paused);
executed 13519 times by 6 tests: return queryState(Paused);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
13519
174}-
175-
176bool QFutureInterfaceBase::isThrottled() const-
177{-
178 return queryState(Throttled);
executed 7 times by 2 tests: return queryState(Throttled);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
7
179}-
180-
181bool QFutureInterfaceBase::isResultReadyAt(int index) const-
182{-
183 QMutexLocker lock(&d->m_mutex);-
184 return d->internal_isResultReadyAt(index);
executed 15004 times by 2 tests: return d->internal_isResultReadyAt(index);
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
15004
185}-
186-
187bool QFutureInterfaceBase::waitForNextResult()-
188{-
189 QMutexLocker lock(&d->m_mutex);-
190 return d->internal_waitForNextResult();
never executed: return d->internal_waitForNextResult();
0
191}-
192-
193void QFutureInterfaceBase::waitForResume()-
194{-
195 // return early if possible to avoid taking the mutex lock.-
196 {-
197 const int state = d->state.load();-
198 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
199 return;
executed 6309 times by 4 tests: return;
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
6309
200 }-
201-
202 QMutexLocker lock(&d->m_mutex);-
203 const int state = d->state.load();-
204 if (!(state & Paused) || (state & Canceled))
!(state & Paused)Description
TRUEnever evaluated
FALSEnever evaluated
(state & Canceled)Description
TRUEnever evaluated
FALSEnever evaluated
0
205 return;
never executed: return;
0
206-
207 // decrease active thread count since this thread will wait.-
208 const ThreadPoolThreadReleaser releaser(d->pool());-
209-
210 d->pausedWaitCondition.wait(&d->m_mutex);-
211}
never executed: end of block
0
212-
213int QFutureInterfaceBase::progressValue() const-
214{-
215 const QMutexLocker lock(&d->m_mutex);-
216 return d->m_progressValue;
executed 17 times by 2 tests: return d->m_progressValue;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
17
217}-
218-
219int QFutureInterfaceBase::progressMinimum() const-
220{-
221 const QMutexLocker lock(&d->m_mutex);-
222 return d->m_progressMinimum;
executed 12 times by 1 test: return d->m_progressMinimum;
Executed by:
  • tst_QFutureWatcher
12
223}-
224-
225int QFutureInterfaceBase::progressMaximum() const-
226{-
227 const QMutexLocker lock(&d->m_mutex);-
228 return d->m_progressMaximum;
executed 12 times by 1 test: return d->m_progressMaximum;
Executed by:
  • tst_QFutureWatcher
12
229}-
230-
231int QFutureInterfaceBase::resultCount() const-
232{-
233 QMutexLocker lock(&d->m_mutex);-
234 return d->internal_resultCount();
executed 28909 times by 3 tests: return d->internal_resultCount();
Executed by:
  • tst_QFuture
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
28909
235}-
236-
237QString QFutureInterfaceBase::progressText() const-
238{-
239 QMutexLocker locker(&d->m_mutex);-
240 return d->m_progressText;
executed 15 times by 2 tests: return d->m_progressText;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
15
241}-
242-
243bool QFutureInterfaceBase::isProgressUpdateNeeded() const-
244{-
245 QMutexLocker locker(&d->m_mutex);-
246 return !d->progressTime.isValid() || (d->progressTime.elapsed() > (1000 / MaxProgressEmitsPerSecond));
executed 104 times by 1 test: return !d->progressTime.isValid() || (d->progressTime.elapsed() > (1000 / MaxProgressEmitsPerSecond));
Executed by:
  • tst_QFutureWatcher
!d->progressTime.isValid()Description
TRUEnever evaluated
FALSEevaluated 104 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
(d->progressTi...itsPerSecond))Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 101 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
0-104
247}-
248-
249void QFutureInterfaceBase::reportStarted()-
250{-
251 QMutexLocker locker(&d->m_mutex);-
252 if (d->state.load() & (Started|Canceled|Finished))
d->state.load(...eled|Finished)Description
TRUEnever evaluated
FALSEevaluated 128312 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-128312
253 return;
never executed: return;
0
254-
255 d->setState(State(Started | Running));-
256 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Started));-
257}
executed 128312 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
128312
258-
259void QFutureInterfaceBase::reportCanceled()-
260{-
261 cancel();-
262}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QFuture
3
263-
264#ifndef QT_NO_EXCEPTIONS-
265void QFutureInterfaceBase::reportException(const QException &exception)-
266{-
267 QMutexLocker locker(&d->m_mutex);-
268 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
269 return;
never executed: return;
0
270-
271 d->m_exceptionStore.setException(exception);-
272 switch_on(d->state, Canceled);-
273 d->waitCondition.wakeAll();-
274 d->pausedWaitCondition.wakeAll();-
275 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));-
276}
executed 17 times by 4 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
17
277#endif-
278-
279void QFutureInterfaceBase::reportFinished()-
280{-
281 QMutexLocker locker(&d->m_mutex);-
282 if (!isFinished()) {
!isFinished()Description
TRUEevaluated 128311 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-128311
283 switch_from_to(d->state, Running, Finished);-
284 d->waitCondition.wakeAll();-
285 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Finished));-
286 }
executed 128311 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
128311
287}
executed 128311 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
128311
288-
289void QFutureInterfaceBase::setExpectedResultCount(int resultCount)-
290{-
291 if (d->manualProgress == false)
d->manualProgress == falseDescription
TRUEnever evaluated
FALSEnever evaluated
0
292 setProgressRange(0, resultCount);
never executed: setProgressRange(0, resultCount);
0
293 d->m_expectedResultCount = resultCount;-
294}
never executed: end of block
0
295-
296int QFutureInterfaceBase::expectedResultCount()-
297{-
298 return d->m_expectedResultCount;
never executed: return d->m_expectedResultCount;
0
299}-
300-
301bool QFutureInterfaceBase::queryState(State state) const-
302{-
303 return d->state.load() & state;
executed 738262 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
738262
304}-
305-
306void QFutureInterfaceBase::waitForResult(int resultIndex)-
307{-
308 d->m_exceptionStore.throwPossibleException();-
309-
310 QMutexLocker lock(&d->m_mutex);-
311 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 60999 times by 7 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
15527-60999
312 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
313 lock.unlock();-
314-
315 // To avoid deadlocks and reduce the number of threads used, try to-
316 // run the runnable in the current thread.-
317 d->pool()->d_func()->stealAndRunRunnable(d->runnable);-
318-
319 lock.relock();-
320-
321 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 60913 times by 6 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
86-60913
322 while (isRunning() && !d->internal_isResultReadyAt(waitIndex))
isRunning()Description
TRUEevaluated 28571 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 463 times by 6 tests
Evaluated by:
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
FALSEevaluated 28108 times by 5 tests
Evaluated by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
463-32891
323 d->waitCondition.wait(&d->m_mutex);
executed 463 times by 6 tests: d->waitCondition.wait(&d->m_mutex);
Executed by:
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
463
324-
325 d->m_exceptionStore.throwPossibleException();-
326}
executed 60997 times by 7 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
60997
327-
328void QFutureInterfaceBase::waitForFinished()-
329{-
330 QMutexLocker lock(&d->m_mutex);-
331 const bool alreadyFinished = !isRunning();-
332 lock.unlock();-
333-
334 if (!alreadyFinished) {
!alreadyFinishedDescription
TRUEevaluated 71671 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 3976 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
3976-71671
335 d->pool()->d_func()->stealAndRunRunnable(d->runnable);-
336-
337 lock.relock();-
338-
339 while (isRunning())
isRunning()Description
TRUEevaluated 38495 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 71671 times by 9 tests
Evaluated by:
  • tst_QDebug
  • tst_QFutureWatcher
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
38495-71671
340 d->waitCondition.wait(&d->m_mutex);
executed 38495 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
38495
341 }
executed 71671 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
71671
342-
343 d->m_exceptionStore.throwPossibleException();-
344}
executed 75636 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
75636
345-
346void QFutureInterfaceBase::reportResultsReady(int beginIndex, int endIndex)-
347{-
348 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
349 return;
executed 53 times by 2 tests: return;
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
53
350-
351 d->waitCondition.wakeAll();-
352-
353 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
354 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
355 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady,-
356 beginIndex,-
357 endIndex));-
358 return;
executed 1119 times by 5 tests: return;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
  • tst_QtConcurrentThreadEngine
1119
359 }-
360-
361 d->sendCallOuts(QFutureCallOutEvent(QFutureCallOutEvent::Progress,-
362 d->m_progressValue,-
363 d->m_progressText),-
364 QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady,-
365 beginIndex,-
366 endIndex));-
367 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
368 }-
369 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady, beginIndex, endIndex));-
370}
executed 712 times by 4 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
712
371-
372void QFutureInterfaceBase::setRunnable(QRunnable *runnable)-
373{-
374 d->runnable = runnable;-
375}
executed 67761 times by 7 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentRun
67761
376-
377void QFutureInterfaceBase::setThreadPool(QThreadPool *pool)-
378{-
379 d->m_pool = pool;-
380}
executed 67761 times by 7 tests: end of block
Executed by:
  • tst_QDebug
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QUrl
  • tst_QtConcurrentRun
67761
381-
382void QFutureInterfaceBase::setFilterMode(bool enable)-
383{-
384 QMutexLocker locker(&d->m_mutex);-
385 resultStoreBase().setFilterMode(enable);-
386}
executed 34 times by 2 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
34
387-
388void QFutureInterfaceBase::setProgressRange(int minimum, int maximum)-
389{-
390 QMutexLocker locker(&d->m_mutex);-
391 d->m_progressMinimum = minimum;-
392 d->m_progressMaximum = maximum;-
393 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange, minimum, maximum));-
394}
executed 260 times by 4 tests: end of block
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
260
395-
396void QFutureInterfaceBase::setProgressValue(int progressValue)-
397{-
398 setProgressValueAndText(progressValue, QString());-
399}
executed 105907 times by 5 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
105907
400-
401void QFutureInterfaceBase::setProgressValueAndText(int progressValue,-
402 const QString &progressText)-
403{-
404 QMutexLocker locker(&d->m_mutex);-
405 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
406 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
407 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
408 return;
executed 48 times by 4 tests: return;
Executed by:
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
48
409-
410 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
411 return;
never executed: return;
0
412-
413 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
414 d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Progress,-
415 d->m_progressValue,-
416 d->m_progressText));-
417 }
executed 524 times by 5 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
524
418}
executed 105864 times by 5 tests: end of block
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
105864
419-
420QMutex *QFutureInterfaceBase::mutex() const-
421{-
422 return &d->m_mutex;
executed 111477 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
111477
423}-
424-
425QtPrivate::ExceptionStore &QFutureInterfaceBase::exceptionStore()-
426{-
427 return d->m_exceptionStore;
executed 3 times by 1 test: return d->m_exceptionStore;
Executed by:
  • tst_QFuture
3
428}-
429-
430QtPrivate::ResultStoreBase &QFutureInterfaceBase::resultStoreBase()-
431{-
432 return d->m_results;
executed 68791 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
68791
433}-
434-
435const QtPrivate::ResultStoreBase &QFutureInterfaceBase::resultStoreBase() const-
436{-
437 return d->m_results;
executed 76496 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
76496
438}-
439-
440QFutureInterfaceBase &QFutureInterfaceBase::operator=(const QFutureInterfaceBase &other)-
441{-
442 other.d->refCount.ref();-
443 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
444 delete d;
executed 74 times by 4 tests: delete d;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
74
445 d = other.d;-
446 return *this;
executed 100 times by 4 tests: return *this;
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
100
447}-
448-
449bool QFutureInterfaceBase::refT() const-
450{-
451 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
452}-
453-
454bool QFutureInterfaceBase::derefT() const-
455{-
456 return d->refCount.derefT();
executed 96297 times by 8 tests: return d->refCount.derefT();
Executed by:
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QLockFile
  • tst_QtConcurrentFilter
  • tst_QtConcurrentIterateKernel
  • tst_QtConcurrentMap
  • tst_QtConcurrentRun
  • tst_QtConcurrentThreadEngine
96297
457}-
458-
459QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)-
460 : refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0),-
461 state(initialState),-
462 manualProgress(false), m_expectedResultCount(0), runnable(0), m_pool(0)-
463{-
464 progressTime.invalidate();-
465}
executed 128673 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
128673
466-
467int QFutureInterfaceBasePrivate::internal_resultCount() const-
468{-
469 return m_results.count(); // ### subtract canceled results.
executed 28909 times by 3 tests: return m_results.count();
Executed by:
  • tst_QFuture
  • tst_QtConcurrentFilter
  • tst_QtConcurrentMap
28909
470}-
471-
472bool QFutureInterfaceBasePrivate::internal_isResultReadyAt(int index) const-
473{-
474 return (m_results.contains(index));
executed 43575 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
43575
475}-
476-
477bool QFutureInterfaceBasePrivate::internal_waitForNextResult()-
478{-
479 if (m_results.hasNextResult())
m_results.hasNextResult()Description
TRUEnever evaluated
FALSEnever evaluated
0
480 return true;
never executed: return true;
0
481-
482 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
483 waitCondition.wait(&m_mutex);
never executed: waitCondition.wait(&m_mutex);
0
484-
485 return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult();
never executed: return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult();
!(state.load()...ase::Canceled)Description
TRUEnever evaluated
FALSEnever evaluated
m_results.hasNextResult()Description
TRUEnever evaluated
FALSEnever evaluated
0
486}-
487-
488bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress,-
489 const QString &progressText)-
490{-
491 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
492 return false;
never executed: return false;
0
493-
494 m_progressValue = progress;-
495 m_progressText = progressText;-
496-
497 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
498 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
499 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
500-
501 progressTime.start();-
502 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
503}-
504-
505void QFutureInterfaceBasePrivate::internal_setThrottled(bool enable)-
506{-
507 // bail out if we are not changing the state-
508 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
509 || (!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
510 return;
executed 1161 times by 1 test: return;
Executed by:
  • tst_QFutureWatcher
1161
511-
512 // change the state-
513 if (enable) {
enableDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEnever evaluated
0-3
514 switch_on(state, QFutureInterfaceBase::Throttled);-
515 } else {
executed 3 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
3
516 switch_off(state, QFutureInterfaceBase::Throttled);-
517 if (!(state.load() & QFutureInterfaceBase::Paused))
!(state.load()...eBase::Paused)Description
TRUEnever evaluated
FALSEnever evaluated
0
518 pausedWaitCondition.wakeAll();
never executed: pausedWaitCondition.wakeAll();
0
519 }
never executed: end of block
0
520}-
521-
522void QFutureInterfaceBasePrivate::sendCallOut(const QFutureCallOutEvent &callOutEvent)-
523{-
524 if (outputConnections.isEmpty())
outputConnections.isEmpty()Description
TRUEevaluated 259338 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 1055 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
1055-259338
525 return;
executed 259338 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
259338
526-
527 for (int i = 0; i < outputConnections.count(); ++i)
i < outputConnections.count()Description
TRUEevaluated 1055 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEevaluated 1055 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
1055
528 outputConnections.at(i)->postCallOutEvent(callOutEvent);
executed 1055 times by 1 test: outputConnections.at(i)->postCallOutEvent(callOutEvent);
Executed by:
  • tst_QFutureWatcher
1055
529}
executed 1055 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
1055
530-
531void QFutureInterfaceBasePrivate::sendCallOuts(const QFutureCallOutEvent &callOutEvent1,-
532 const QFutureCallOutEvent &callOutEvent2)-
533{-
534 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
535 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
536-
537 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
538 QFutureCallOutInterface *interface = outputConnections.at(i);-
539 interface->postCallOutEvent(callOutEvent1);-
540 interface->postCallOutEvent(callOutEvent2);-
541 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
6
542}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
6
543-
544// This function connects an output interface (for example a QFutureWatcher)-
545// to this future. While holding the lock we check the state and ready results-
546// and add the appropriate callouts to the queue. In order to avoid deadlocks,-
547// the actual callouts are made at the end while not holding the lock.-
548void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface *interface)-
549{-
550 QMutexLocker locker(&m_mutex);-
551-
552 if (state.load() & QFutureInterfaceBase::Started) {
state.load() &...eBase::StartedDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
FALSEnever evaluated
0-28
553 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Started));-
554 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange,-
555 m_progressMinimum,-
556 m_progressMaximum));-
557 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Progress,-
558 m_progressValue,-
559 m_progressText));-
560 }
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
28
561-
562 QtPrivate::ResultIteratorBase it = m_results.begin();-
563 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
564 const int begin = it.resultIndex();-
565 const int end = begin + it.batchSize();-
566 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ResultsReady,-
567 begin,-
568 end));-
569 it.batchedAdvance();-
570 }
executed 177 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
177
571-
572 if (state.load() & QFutureInterfaceBase::Paused)
state.load() &...ceBase::PausedDescription
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QFutureWatcher
0-28
573 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused));
never executed: interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused));
0
574-
575 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
576 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));
executed 5 times by 1 test: interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));
Executed by:
  • tst_QFutureWatcher
5
577-
578 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
579 interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished));
executed 14 times by 1 test: interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished));
Executed by:
  • tst_QFutureWatcher
14
580-
581 outputConnections.append(interface);-
582}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
28
583-
584void QFutureInterfaceBasePrivate::disconnectOutputInterface(QFutureCallOutInterface *interface)-
585{-
586 QMutexLocker lock(&m_mutex);-
587 const int index = outputConnections.indexOf(interface);-
588 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
589 return;
executed 23 times by 1 test: return;
Executed by:
  • tst_QFutureWatcher
23
590 outputConnections.removeAt(index);-
591-
592 interface->callOutInterfaceDisconnected();-
593}
executed 28 times by 1 test: end of block
Executed by:
  • tst_QFutureWatcher
28
594-
595void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState)-
596{-
597 state.store(newState);-
598}
executed 128312 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
128312
599-
600QT_END_NAMESPACE-
601-
602#endif // QT_NO_QFUTURE-
Source codeSwitch to Preprocessed file

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