| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | QThreadData::QThreadData(int initialRefCount) | - |
| 11 | : _ref(initialRefCount), thread(0), threadId(0), | - |
| 12 | quitNow(false), loopLevel(0), eventDispatcher(0), canWait(true), isAdopted(false) | - |
| 13 | { | - |
| 14 | | - |
| 15 | } executed: }Execution Count:1627245 | 1627245 |
| 16 | | - |
| 17 | QThreadData::~QThreadData() | - |
| 18 | { | - |
| 19 | qt_noop(); | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | if (this->thread == QCoreApplicationPrivate::theMainThread) { partially evaluated: this->thread == QCoreApplicationPrivate::theMainThread| no Evaluation Count:0 | yes Evaluation Count:1627422 |
| 0-1627422 |
| 28 | QCoreApplicationPrivate::theMainThread = 0; | - |
| 29 | } | 0 |
| 30 | | - |
| 31 | QThread *t = thread; | - |
| 32 | thread = 0; | - |
| 33 | delete t; | - |
| 34 | | - |
| 35 | for (int i = 0; i < postEventList.size(); ++i) { evaluated: i < postEventList.size()| yes Evaluation Count:106 | yes Evaluation Count:1627422 |
| 106-1627422 |
| 36 | const QPostEvent &pe = postEventList.at(i); | - |
| 37 | if (pe.event) { partially evaluated: pe.event| no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
| 38 | --pe.receiver->d_func()->postedEvents; | - |
| 39 | pe.event->posted = false; | - |
| 40 | delete pe.event; | - |
| 41 | } | 0 |
| 42 | } executed: }Execution Count:106 | 106 |
| 43 | | - |
| 44 | | - |
| 45 | } executed: }Execution Count:1627422 | 1627422 |
| 46 | | - |
| 47 | void QThreadData::ref() | - |
| 48 | { | - |
| 49 | | - |
| 50 | (void) _ref.ref(); | - |
| 51 | qt_noop(); | - |
| 52 | | - |
| 53 | } executed: }Execution Count:5364903 | 5364903 |
| 54 | | - |
| 55 | void QThreadData::deref() | - |
| 56 | { | - |
| 57 | | - |
| 58 | if (!_ref.deref()) evaluated: !_ref.deref()| yes Evaluation Count:1627422 | yes Evaluation Count:5362763 |
| 1627422-5362763 |
| 59 | delete this; executed: delete this;Execution Count:1627422 | 1627422 |
| 60 | | - |
| 61 | } executed: }Execution Count:6990175 | 6990175 |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | QAdoptedThread::QAdoptedThread(QThreadData *data) | - |
| 68 | : QThread(*new QThreadPrivate(data)) | - |
| 69 | { | - |
| 70 | | - |
| 71 | | - |
| 72 | | - |
| 73 | d_func()->running = true; | - |
| 74 | d_func()->finished = false; | - |
| 75 | init(); | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | } executed: }Execution Count:18 | 18 |
| 80 | | - |
| 81 | QAdoptedThread::~QAdoptedThread() | - |
| 82 | { | - |
| 83 | | - |
| 84 | } | - |
| 85 | | - |
| 86 | void QAdoptedThread::run() | - |
| 87 | { | - |
| 88 | | - |
| 89 | QMessageLogger("thread/qthread.cpp", 139, __PRETTY_FUNCTION__).fatal("QAdoptedThread::run(): Internal error, this implementation should never be called."); | - |
| 90 | } | 0 |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | QThreadPrivate::QThreadPrivate(QThreadData *d) | - |
| 97 | : QObjectPrivate(), running(false), finished(false), | - |
| 98 | isInFinish(false), exited(false), returnCode(-1), | - |
| 99 | stackSize(0), priority(QThread::InheritPriority), data(d) | - |
| 100 | { | - |
| 101 | | - |
| 102 | thread_id = 0; | - |
| 103 | if (!data) evaluated: !data| yes Evaluation Count:1627222 | yes Evaluation Count:18 |
| 18-1627222 |
| 104 | data = new QThreadData; executed: data = new QThreadData;Execution Count:1627222 | 1627222 |
| 105 | } executed: }Execution Count:1627240 | 1627240 |
| 106 | | - |
| 107 | QThreadPrivate::~QThreadPrivate() | - |
| 108 | { | - |
| 109 | data->deref(); | - |
| 110 | } executed: }Execution Count:1627425 | 1627425 |
| 111 | QThread *QThread::currentThread() | - |
| 112 | { | - |
| 113 | QThreadData *data = QThreadData::current(); | - |
| 114 | qt_noop(); | - |
| 115 | return data->thread; executed: return data->thread;Execution Count:3732293 | 3732293 |
| 116 | } | - |
| 117 | QThread::QThread(QObject *parent) | - |
| 118 | : QObject(*(new QThreadPrivate), parent) | - |
| 119 | { | - |
| 120 | QThreadPrivate * const d = d_func(); | - |
| 121 | | - |
| 122 | d->data->thread = this; | - |
| 123 | } executed: }Execution Count:1627222 | 1627222 |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | QThread::QThread(QThreadPrivate &dd, QObject *parent) | - |
| 129 | : QObject(dd, parent) | - |
| 130 | { | - |
| 131 | QThreadPrivate * const d = d_func(); | - |
| 132 | | - |
| 133 | d->data->thread = this; | - |
| 134 | } executed: }Execution Count:18 | 18 |
| 135 | QThread::~QThread() | - |
| 136 | { | - |
| 137 | QThreadPrivate * const d = d_func(); | - |
| 138 | { | - |
| 139 | QMutexLocker locker(&d->mutex); | - |
| 140 | if (d->isInFinish) { evaluated: d->isInFinish| yes Evaluation Count:17 | yes Evaluation Count:1627408 |
| 17-1627408 |
| 141 | locker.unlock(); | - |
| 142 | wait(); | - |
| 143 | locker.relock(); | - |
| 144 | } executed: }Execution Count:17 | 17 |
| 145 | if (d->running && !d->finished && !d->data->isAdopted) partially evaluated: d->running| no Evaluation Count:0 | yes Evaluation Count:1627425 |
never evaluated: !d->finished never evaluated: !d->data->isAdopted | 0-1627425 |
| 146 | QMessageLogger("thread/qthread.cpp", 421, __PRETTY_FUNCTION__).warning("QThread: Destroyed while thread is still running"); never executed: QMessageLogger("thread/qthread.cpp", 421, __PRETTY_FUNCTION__).warning("QThread: Destroyed while thread is still running"); | 0 |
| 147 | | - |
| 148 | d->data->thread = 0; | - |
| 149 | } | - |
| 150 | } executed: }Execution Count:1627425 | 1627425 |
| 151 | | - |
| 152 | | - |
| 153 | | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | bool QThread::isFinished() const | - |
| 158 | { | - |
| 159 | const QThreadPrivate * const d = d_func(); | - |
| 160 | QMutexLocker locker(&d->mutex); | - |
| 161 | return d->finished || d->isInFinish; executed: return d->finished || d->isInFinish;Execution Count:3029 | 3029 |
| 162 | } | - |
| 163 | | - |
| 164 | | - |
| 165 | | - |
| 166 | | - |
| 167 | | - |
| 168 | | - |
| 169 | bool QThread::isRunning() const | - |
| 170 | { | - |
| 171 | const QThreadPrivate * const d = d_func(); | - |
| 172 | QMutexLocker locker(&d->mutex); | - |
| 173 | return d->running && !d->isInFinish; executed: return d->running && !d->isInFinish;Execution Count:460 | 460 |
| 174 | } | - |
| 175 | void QThread::setStackSize(uint stackSize) | - |
| 176 | { | - |
| 177 | QThreadPrivate * const d = d_func(); | - |
| 178 | QMutexLocker locker(&d->mutex); | - |
| 179 | qt_noop(); | - |
| 180 | | - |
| 181 | d->stackSize = stackSize; | - |
| 182 | } executed: }Execution Count:2 | 2 |
| 183 | | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | | - |
| 188 | | - |
| 189 | | - |
| 190 | uint QThread::stackSize() const | - |
| 191 | { | - |
| 192 | const QThreadPrivate * const d = d_func(); | - |
| 193 | QMutexLocker locker(&d->mutex); | - |
| 194 | return d->stackSize; executed: return d->stackSize;Execution Count:3 | 3 |
| 195 | } | - |
| 196 | int QThread::exec() | - |
| 197 | { | - |
| 198 | QThreadPrivate * const d = d_func(); | - |
| 199 | QMutexLocker locker(&d->mutex); | - |
| 200 | d->data->quitNow = false; | - |
| 201 | if (d->exited) { evaluated: d->exited| yes Evaluation Count:5 | yes Evaluation Count:626 |
| 5-626 |
| 202 | d->exited = false; | - |
| 203 | return d->returnCode; executed: return d->returnCode;Execution Count:5 | 5 |
| 204 | } | - |
| 205 | locker.unlock(); | - |
| 206 | | - |
| 207 | QEventLoop eventLoop; | - |
| 208 | int returnCode = eventLoop.exec(); | - |
| 209 | | - |
| 210 | locker.relock(); | - |
| 211 | d->exited = false; | - |
| 212 | d->returnCode = -1; | - |
| 213 | return returnCode; executed: return returnCode;Execution Count:627 | 627 |
| 214 | } | - |
| 215 | void QThread::exit(int returnCode) | - |
| 216 | { | - |
| 217 | QThreadPrivate * const d = d_func(); | - |
| 218 | QMutexLocker locker(&d->mutex); | - |
| 219 | d->exited = true; | - |
| 220 | d->returnCode = returnCode; | - |
| 221 | d->data->quitNow = true; | - |
| 222 | for (int i = 0; i < d->data->eventLoops.size(); ++i) { evaluated: i < d->data->eventLoops.size()| yes Evaluation Count:628 | yes Evaluation Count:642 |
| 628-642 |
| 223 | QEventLoop *eventLoop = d->data->eventLoops.at(i); | - |
| 224 | eventLoop->exit(returnCode); | - |
| 225 | } executed: }Execution Count:628 | 628 |
| 226 | } executed: }Execution Count:642 | 642 |
| 227 | void QThread::quit() | - |
| 228 | { exit(); } executed: exit();Execution Count:591 | 591 |
| 229 | void QThread::run() | - |
| 230 | { | - |
| 231 | (void) exec(); | - |
| 232 | } executed: }Execution Count:568 | 568 |
| 233 | QThread::Priority QThread::priority() const | - |
| 234 | { | - |
| 235 | const QThreadPrivate * const d = d_func(); | - |
| 236 | QMutexLocker locker(&d->mutex); | - |
| 237 | | - |
| 238 | | - |
| 239 | return Priority(d->priority & 0xffff); executed: return Priority(d->priority & 0xffff);Execution Count:33 | 33 |
| 240 | } | - |
| 241 | QAbstractEventDispatcher *QThread::eventDispatcher() const | - |
| 242 | { | - |
| 243 | const QThreadPrivate * const d = d_func(); | - |
| 244 | return d->data->eventDispatcher; executed: return d->data->eventDispatcher;Execution Count:6 | 6 |
| 245 | } | - |
| 246 | void QThread::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher) | - |
| 247 | { | - |
| 248 | QThreadPrivate * const d = d_func(); | - |
| 249 | if (d->data->eventDispatcher != 0) { partially evaluated: d->data->eventDispatcher != 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 250 | QMessageLogger("thread/qthread.cpp", 770, __PRETTY_FUNCTION__).warning("QThread::setEventDispatcher: An event dispatcher has already been created for this thread"); | - |
| 251 | } else { | 0 |
| 252 | eventDispatcher->moveToThread(this); | - |
| 253 | if (eventDispatcher->thread() == this) partially evaluated: eventDispatcher->thread() == this| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 254 | d->data->eventDispatcher = eventDispatcher; executed: d->data->eventDispatcher = eventDispatcher;Execution Count:2 | 2 |
| 255 | else | - |
| 256 | QMessageLogger("thread/qthread.cpp", 776, __PRETTY_FUNCTION__).warning("QThread::setEventDispatcher: Could not move event dispatcher to target thread"); never executed: QMessageLogger("thread/qthread.cpp", 776, __PRETTY_FUNCTION__).warning("QThread::setEventDispatcher: Could not move event dispatcher to target thread"); | 0 |
| 257 | } | - |
| 258 | } | - |
| 259 | | - |
| 260 | | - |
| 261 | | - |
| 262 | | - |
| 263 | bool QThread::event(QEvent *event) | - |
| 264 | { | - |
| 265 | if (event->type() == QEvent::Quit) { evaluated: event->type() == QEvent::Quit| yes Evaluation Count:1 | yes Evaluation Count:2102 |
| 1-2102 |
| 266 | quit(); | - |
| 267 | return true; executed: return true;Execution Count:1 | 1 |
| 268 | } else { | - |
| 269 | return QObject::event(event); executed: return QObject::event(event);Execution Count:2102 | 2102 |
| 270 | } | - |
| 271 | } | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| | |