qtconcurrentthreadengine.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/concurrent/qtconcurrentthreadengine.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qtconcurrentthreadengine.h"-
41-
42#ifndef QT_NO_CONCURRENT-
43-
44QT_BEGIN_NAMESPACE-
45-
46namespace QtConcurrent {-
47-
48ThreadEngineBarrier::ThreadEngineBarrier()-
49:
executed 81088 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
count(0) { }
executed 81088 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
81088
50-
51void ThreadEngineBarrier::acquire()-
52{-
53 forever {-
54 int localCount = count.load();-
55 if (localCount < 0) {
localCount < 0Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 161488 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
42-161488
56 if (count.testAndSetOrdered(localCount, localCount -1))
count.testAndS...localCount -1)Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-42
57 return;
executed 42 times by 2 tests: return;
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
42
58 } else {
never executed: end of block
0
59 if (count.testAndSetOrdered(localCount, localCount + 1))
count.testAndS...ocalCount + 1)Description
TRUEevaluated 161488 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-161488
60 return;
executed 161488 times by 5 tests: return;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
161488
61 }
never executed: end of block
0
62 }-
63}
never executed: end of block
0
64-
65int ThreadEngineBarrier::release()-
66{-
67 forever {-
68 int localCount = count.load();-
69 if (localCount == -1) {
localCount == -1Description
TRUEevaluated 73 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 161446 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
73-161446
70 if (count.testAndSetOrdered(-1, 0)) {
count.testAndSetOrdered(-1, 0)Description
TRUEevaluated 73 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-73
71 semaphore.release();-
72 return 0;
executed 73 times by 4 tests: return 0;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
73
73 }-
74 } else if (localCount < 0) {
never executed: end of block
localCount < 0Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 161404 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
0-161404
75 if (count.testAndSetOrdered(localCount, localCount + 1))
count.testAndS...ocalCount + 1)Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-42
76 return qAbs(localCount + 1);
executed 42 times by 2 tests: return qAbs(localCount + 1);
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
42
77 } else {
never executed: end of block
0
78 if (count.testAndSetOrdered(localCount, localCount - 1))
count.testAndS...ocalCount - 1)Description
TRUEevaluated 161404 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-161404
79 return localCount - 1;
executed 161404 times by 5 tests: return localCount - 1;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
161404
80 }
never executed: end of block
0
81 }-
82}
never executed: end of block
0
83-
84// Wait until all threads have been released-
85void ThreadEngineBarrier::wait()-
86{-
87 forever {-
88 int localCount = count.load();-
89 if (localCount == 0)
localCount == 0Description
TRUEevaluated 20496 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 73 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
73-20496
90 return;
executed 20496 times by 4 tests: return;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
20496
91-
92 Q_ASSERT(localCount > 0); // multiple waiters are not allowed.-
93 if (count.testAndSetOrdered(localCount, -localCount)) {
count.testAndS..., -localCount)Description
TRUEevaluated 73 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-73
94 semaphore.acquire();-
95 return;
executed 73 times by 4 tests: return;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
73
96 }-
97 }
never executed: end of block
0
98}
never executed: end of block
0
99-
100int ThreadEngineBarrier::currentCount()-
101{-
102 return count.load();
never executed: return count.load();
0
103}-
104-
105// releases a thread, unless this is the last thread.-
106// returns true if the thread was released.-
107bool ThreadEngineBarrier::releaseUnlessLast()-
108{-
109 forever {-
110 int localCount = count.load();-
111 if (qAbs(localCount) == 1) {
qAbs(localCount) == 1Description
TRUEevaluated 2084 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
11-2084
112 return false;
executed 2084 times by 2 tests: return false;
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
2084
113 } else if (localCount < 0) {
localCount < 0Description
TRUEnever evaluated
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
0-11
114 if (count.testAndSetOrdered(localCount, localCount + 1))
count.testAndS...ocalCount + 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
115 return true;
never executed: return true;
0
116 } else {
never executed: end of block
0
117 if (count.testAndSetOrdered(localCount, localCount - 1))
count.testAndS...ocalCount - 1)Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-11
118 return true;
executed 11 times by 2 tests: return true;
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
11
119 }
never executed: end of block
0
120 }-
121}
never executed: end of block
0
122-
123ThreadEngineBase::ThreadEngineBase()-
124:futureInterface(0), threadPool(QThreadPool::globalInstance())-
125{-
126 setAutoDelete(false);-
127}
executed 81088 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
81088
128-
129ThreadEngineBase::~ThreadEngineBase() {}-
130-
131void ThreadEngineBase::startSingleThreaded()-
132{-
133 start();-
134 while (threadFunction() != ThreadFinished)
threadFunction...ThreadFinishedDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qtconcurrentthreadengine - unknown status
0-1
135 ;
never executed: ;
0
136 finish();-
137}
executed 1 time by 1 test: end of block
Executed by:
  • tst_qtconcurrentthreadengine - unknown status
1
138-
139void ThreadEngineBase::startBlocking()-
140{-
141 start();-
142 barrier.acquire();-
143 startThreads();-
144-
145 bool throttled = false;-
146#ifndef QT_NO_EXCEPTIONS-
147 try {-
148#endif-
149 while (threadFunction() == ThrottleThread) {
threadFunction...ThrottleThreadDescription
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 20554 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
11-20554
150 if (threadThrottleExit()) {
threadThrottleExit()Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEnever evaluated
0-11
151 throttled = true;-
152 break;
executed 11 times by 2 tests: break;
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
11
153 }-
154 }
never executed: end of block
0
155#ifndef QT_NO_EXCEPTIONS-
156 } catch (QException &e) {
executed 20565 times by 4 tests: end of block
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
20565
157 handleException(e);-
158 } catch (...) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qtconcurrentthreadengine - unknown status
2
159 handleException(QUnhandledException());-
160 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qtconcurrentthreadengine - unknown status
2
161#endif-
162-
163 if (throttled == false) {
throttled == falseDescription
TRUEevaluated 20558 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
11-20558
164 barrier.release();-
165 }
executed 20558 times by 4 tests: end of block
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
20558
166-
167 barrier.wait();-
168 finish();-
169 exceptionStore.throwPossibleException();-
170}
executed 20565 times by 4 tests: end of block
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
20565
171-
172void ThreadEngineBase::startThread()-
173{-
174 startThreadInternal();-
175}
executed 19222 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
19222
176-
177void ThreadEngineBase::acquireBarrierSemaphore()-
178{-
179 barrier.acquire();-
180}
executed 60519 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
60519
181-
182bool ThreadEngineBase::isCanceled()-
183{-
184 if (futureInterface)
futureInterfaceDescription
TRUEevaluated 133141 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 48099 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
48099-133141
185 return futureInterface->isCanceled();
executed 133141 times by 5 tests: return futureInterface->isCanceled();
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
133141
186 else-
187 return false;
executed 48099 times by 4 tests: return false;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
48099
188}-
189-
190void ThreadEngineBase::waitForResume()-
191{-
192 if (futureInterface)
futureInterfaceDescription
TRUEevaluated 6309 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEevaluated 13666 times by 3 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
6309-13666
193 futureInterface->waitForResume();
executed 6309 times by 4 tests: futureInterface->waitForResume();
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
6309
194}
executed 19975 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
19975
195-
196bool ThreadEngineBase::isProgressReportingEnabled()-
197{-
198 // If we don't have a QFuture, there is no-one to report the progress to.-
199 return (futureInterface != 0);
executed 20914 times by 4 tests: return (futureInterface != 0);
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
20914
200}-
201-
202void ThreadEngineBase::setProgressValue(int progress)-
203{-
204 if (futureInterface)
futureInterfaceDescription
TRUEevaluated 5904 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEnever evaluated
0-5904
205 futureInterface->setProgressValue(progress);
executed 5904 times by 4 tests: futureInterface->setProgressValue(progress);
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
5904
206}
executed 5904 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
5904
207-
208void ThreadEngineBase::setProgressRange(int minimum, int maximum)-
209{-
210 if (futureInterface)
futureInterfaceDescription
TRUEevaluated 259 times by 4 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
FALSEnever evaluated
0-259
211 futureInterface->setProgressRange(minimum, maximum);
executed 259 times by 4 tests: futureInterface->setProgressRange(minimum, maximum);
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
259
212}
executed 259 times by 4 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
259
213-
214bool ThreadEngineBase::startThreadInternal()-
215{-
216 if (this->isCanceled())
this->isCanceled()Description
TRUEnever evaluated
FALSEevaluated 80442 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
0-80442
217 return false;
never executed: return false;
0
218-
219 barrier.acquire();-
220 if (!threadPool->tryStart(this)) {
!threadPool->tryStart(this)Description
TRUEevaluated 80205 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 237 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
237-80205
221 barrier.release();-
222 return false;
executed 80205 times by 5 tests: return false;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
80205
223 }-
224 return true;
executed 237 times by 4 tests: return true;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
237
225}-
226-
227void ThreadEngineBase::startThreads()-
228{-
229 while (shouldStartThread() && startThreadInternal())
shouldStartThread()Description
TRUEevaluated 61220 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 20239 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
startThreadInternal()Description
TRUEevaluated 236 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 60984 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
236-61220
230 ;
executed 236 times by 4 tests: ;
Executed by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
236
231}
executed 81223 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
81223
232-
233void ThreadEngineBase::threadExit()-
234{-
235 const bool asynchronous = futureInterface != 0;-
236 const int lastThread = (barrier.release() == 0);-
237-
238 if (lastThread && asynchronous)
lastThreadDescription
TRUEevaluated 60592 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 164 times by 3 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
asynchronousDescription
TRUEevaluated 60519 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 73 times by 4 tests
Evaluated by:
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
73-60592
239 this->asynchronousFinish();
executed 60519 times by 5 tests: this->asynchronousFinish();
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
60519
240}
executed 60756 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
60756
241-
242// Called by a worker thread that wants to be throttled. If the current number-
243// of running threads is larger than one the thread is allowed to exit and-
244// this function returns one.-
245bool ThreadEngineBase::threadThrottleExit()-
246{-
247 return barrier.releaseUnlessLast();
executed 2095 times by 2 tests: return barrier.releaseUnlessLast();
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
2095
248}-
249-
250void ThreadEngineBase::run() // implements QRunnable.-
251{-
252 if (this->isCanceled()) {
this->isCanceled()Description
TRUEevaluated 102 times by 3 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 60654 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
102-60654
253 threadExit();-
254 return;
executed 102 times by 3 tests: return;
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
102
255 }-
256-
257 startThreads();-
258-
259#ifndef QT_NO_EXCEPTIONS-
260 try {-
261#endif-
262 while (threadFunction() == ThrottleThread) {
threadFunction...ThrottleThreadDescription
TRUEevaluated 2084 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 60647 times by 5 tests
Evaluated by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
2084-60647
263 // threadFunction returning ThrottleThread means it that the user-
264 // struct wants to be throttled by making a worker thread exit.-
265 // Respect that request unless this is the only worker thread left-
266 // running, in which case it has to keep going.-
267 if (threadThrottleExit())
threadThrottleExit()Description
TRUEnever evaluated
FALSEevaluated 2084 times by 2 tests
Evaluated by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
0-2084
268 return;
never executed: return;
0
269 }
executed 2084 times by 2 tests: end of block
Executed by:
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentthreadengine - unknown status
2084
270-
271#ifndef QT_NO_EXCEPTIONS-
272 } catch (QException &e) {
executed 60647 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
60647
273 handleException(e);-
274 } catch (...) {
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
4
275 handleException(QUnhandledException());-
276 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_qtconcurrentthreadengine - unknown status
3
277#endif-
278 threadExit();-
279}
executed 60654 times by 5 tests: end of block
Executed by:
  • tst_qfuturewatcher - unknown status
  • tst_qtconcurrentfilter - unknown status
  • tst_qtconcurrentiteratekernel - unknown status
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
60654
280-
281#ifndef QT_NO_EXCEPTIONS-
282-
283void ThreadEngineBase::handleException(const QException &exception)-
284{-
285 if (futureInterface)
futureInterfaceDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qtconcurrentthreadengine - unknown status
3-8
286 futureInterface->reportException(exception);
executed 3 times by 2 tests: futureInterface->reportException(exception);
Executed by:
  • tst_qtconcurrentmap - unknown status
  • tst_qtconcurrentthreadengine - unknown status
3
287 else-
288 exceptionStore.setException(exception);
executed 8 times by 1 test: exceptionStore.setException(exception);
Executed by:
  • tst_qtconcurrentthreadengine - unknown status
8
289}-
290#endif-
291-
292-
293} // namepsace QtConcurrent-
294-
295QT_END_NAMESPACE-
296-
297#endif // QT_NO_CONCURRENT-
Source codeSwitch to Preprocessed file

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