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

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