OpenCoverage

qthread_unix.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/thread/qthread_unix.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41#include "qthread.h"-
42-
43#include "qplatformdefs.h"-
44-
45#include <private/qcoreapplication_p.h>-
46#include <private/qcore_unix_p.h>-
47-
48#if defined(Q_OS_OSX)-
49# include <private/qeventdispatcher_cf_p.h>-
50#else-
51# if !defined(QT_NO_GLIB)-
52# include "../kernel/qeventdispatcher_glib_p.h"-
53# endif-
54#endif-
55-
56#include <private/qeventdispatcher_unix_p.h>-
57-
58#include "qthreadstorage.h"-
59-
60#include "qthread_p.h"-
61-
62#include "qdebug.h"-
63-
64#include <sched.h>-
65#include <errno.h>-
66-
67#ifdef Q_OS_BSD4-
68#include <sys/sysctl.h>-
69#endif-
70#ifdef Q_OS_VXWORKS-
71# if (_WRS_VXWORKS_MAJOR > 6) || ((_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR >= 6))-
72# include <vxCpuLib.h>-
73# include <cpuset.h>-
74# define QT_VXWORKS_HAS_CPUSET-
75# endif-
76#endif-
77-
78#ifdef Q_OS_HPUX-
79#include <sys/pstat.h>-
80#endif-
81-
82#if defined(Q_OS_MAC)-
83# ifdef qDebug-
84# define old_qDebug qDebug-
85# undef qDebug-
86# endif-
87-
88# ifdef old_qDebug-
89# undef qDebug-
90# define qDebug QT_NO_QDEBUG_MACRO-
91# undef old_qDebug-
92# endif-
93#endif-
94-
95#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)-
96#include <sys/prctl.h>-
97#endif-
98-
99#if defined(Q_OS_LINUX) && !defined(SCHED_IDLE)-
100// from linux/sched.h-
101# define SCHED_IDLE 5-
102#endif-
103-
104#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)-
105#define QT_HAS_THREAD_PRIORITY_SCHEDULING-
106#endif-
107-
108-
109QT_BEGIN_NAMESPACE-
110-
111#ifndef QT_NO_THREAD-
112-
113Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE));-
114-
115enum { ThreadPriorityResetFlag = 0x80000000 };-
116-
117#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_LINUXBASE)-
118/* LSB doesn't have __thread, https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=993 */-
119#define HAVE_TLS-
120#endif-
121#if defined(Q_CC_XLC) || defined (Q_CC_SUN)-
122#define HAVE_TLS-
123#endif-
124-
125#ifdef HAVE_TLS-
126static __thread QThreadData *currentThreadData = 0;-
127#endif-
128-
129static pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT;-
130static pthread_key_t current_thread_data_key;-
131-
132static void destroy_current_thread_data(void *p)-
133{-
134#if defined(Q_OS_VXWORKS)-
135 // Calling setspecific(..., 0) sets the value to 0 for ALL threads.-
136 // The 'set to 1' workaround adds a bit of an overhead though,-
137 // since this function is called twice now.-
138 if (p == (void *)1)-
139 return;-
140#endif-
141 // POSIX says the value in our key is set to zero before calling-
142 // this destructor function, so we need to set it back to the-
143 // right value...-
144 pthread_setspecific(current_thread_data_key, p);-
145 QThreadData *data = static_cast<QThreadData *>(p);-
146 if (data->isAdopted) {
data->isAdoptedDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QThread
FALSEevaluated 620183 times by 512 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFtp
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • tst_QMutex
  • ...
17-620183
147 QThread *thread = data->thread;-
148 Q_ASSERT(thread);-
149 QThreadPrivate *thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));-
150 Q_ASSERT(!thread_p->finished);-
151 thread_p->finish(thread);-
152 }
executed 17 times by 1 test: end of block
Executed by:
  • tst_QThread
17
153 data->deref();-
154-
155 // ... but we must reset it to zero before returning so we aren't-
156 // called again (POSIX allows implementations to call destructor-
157 // functions repeatedly until all values are zero)-
158 pthread_setspecific(current_thread_data_key,-
159#if defined(Q_OS_VXWORKS)-
160 (void *)1);-
161#else-
162 0);-
163#endif-
164}
executed 620200 times by 512 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFtp
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • tst_QMutex
  • ...
620200
165-
166static void create_current_thread_data_key()-
167{-
168 pthread_key_create(&current_thread_data_key, destroy_current_thread_data);-
169}
executed 1104 times by 15 tests: end of block
Executed by:
  • tst_qapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
1104
170-
171static void destroy_current_thread_data_key()-
172{-
173 pthread_once(&current_thread_data_once, create_current_thread_data_key);-
174 pthread_key_delete(current_thread_data_key);-
175-
176 // Reset current_thread_data_once in case we end up recreating-
177 // the thread-data in the rare case of QObject construction-
178 // after destroying the QThreadData.-
179 pthread_once_t pthread_once_init = PTHREAD_ONCE_INIT;-
180 current_thread_data_once = pthread_once_init;-
181}
never executed: end of block
0
182Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key)
never executed: end of block
0
183-
184-
185// Utility functions for getting, setting and clearing thread specific data.-
186static QThreadData *get_thread_data()-
187{-
188#ifdef HAVE_TLS-
189 return currentThreadData;
executed 43687172 times by 1014 tests: return currentThreadData;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
43687172
190#else-
191 pthread_once(&current_thread_data_once, create_current_thread_data_key);-
192 return reinterpret_cast<QThreadData *>(pthread_getspecific(current_thread_data_key));-
193#endif-
194}-
195-
196static void set_thread_data(QThreadData *data)-
197{-
198#ifdef HAVE_TLS-
199 currentThreadData = data;-
200#endif-
201 pthread_once(&current_thread_data_once, create_current_thread_data_key);-
202 pthread_setspecific(current_thread_data_key, data);-
203}
executed 621808 times by 523 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
621808
204-
205static void clear_thread_data()-
206{-
207#ifdef HAVE_TLS-
208 currentThreadData = 0;-
209#endif-
210 pthread_setspecific(current_thread_data_key, 0);-
211}
executed 1087 times by 346 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractfileengine - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaction - unknown status
  • tst_qasn1element - unknown status
  • tst_qatomicint - unknown status
  • tst_qauthenticator - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuffer - unknown status
  • tst_qbytearray - unknown status
  • ...
1087
212-
213template <typename T>-
214static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, Qt::HANDLE>::Type to_HANDLE(T id)-
215{-
216 return reinterpret_cast<Qt::HANDLE>(static_cast<intptr_t>(id));
executed 14588472 times by 801 tests: return reinterpret_cast<Qt::HANDLE>(static_cast<intptr_t>(id));
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
14588472
217}-
218-
219template <typename T>-
220static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type from_HANDLE(Qt::HANDLE id)-
221{-
222 return static_cast<T>(reinterpret_cast<intptr_t>(id));
executed 1240826 times by 1012 tests: return static_cast<T>(reinterpret_cast<intptr_t>(id));
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1240826
223}-
224-
225template <typename T>-
226static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, Qt::HANDLE>::Type to_HANDLE(T id)-
227{-
228 return id;
never executed: return id;
0
229}-
230-
231template <typename T>-
232static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, T>::Type from_HANDLE(Qt::HANDLE id)-
233{-
234 return static_cast<T>(id);
never executed: return static_cast<T>(id);
0
235}-
236-
237void QThreadData::clearCurrentThreadData()-
238{-
239 clear_thread_data();-
240}
executed 1087 times by 346 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractfileengine - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaction - unknown status
  • tst_qasn1element - unknown status
  • tst_qatomicint - unknown status
  • tst_qauthenticator - unknown status
  • tst_qboxlayout - unknown status
  • tst_qbrush - unknown status
  • tst_qbuffer - unknown status
  • tst_qbytearray - unknown status
  • ...
1087
241-
242QThreadData *QThreadData::current(bool createIfNecessary)-
243{-
244 QThreadData *data = get_thread_data();-
245 if (!data && createIfNecessary) {
!dataDescription
TRUEevaluated 1125 times by 19 tests
Evaluated by:
  • tst_QThread
  • tst_qapplication - unknown status
  • tst_qcoreapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlockfile - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_qtextstream - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
FALSEevaluated 43686044 times by 1014 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
createIfNecessaryDescription
TRUEevaluated 1125 times by 19 tests
Evaluated by:
  • tst_QThread
  • tst_qapplication - unknown status
  • tst_qcoreapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlockfile - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_qtextstream - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
FALSEnever evaluated
0-43686044
246 data = new QThreadData;-
247 QT_TRY {-
248 set_thread_data(data);-
249 data->thread = new QAdoptedThread(data);-
250 } QT_CATCH(...) {
executed 1125 times by 19 tests: end of block
Executed by:
  • tst_QThread
  • tst_qapplication - unknown status
  • tst_qcoreapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlockfile - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_qtextstream - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
1125
251 clear_thread_data();-
252 data->deref();-
253 data = 0;-
254 QT_RETHROW;
never executed: throw;
0
255 }-
256 data->deref();-
257 data->isAdopted = true;-
258 data->threadId = to_HANDLE(pthread_self());-
259 if (!QCoreApplicationPrivate::theMainThread)
!QCoreApplicat...:theMainThreadDescription
TRUEevaluated 1108 times by 18 tests
Evaluated by:
  • tst_qapplication - unknown status
  • tst_qcoreapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlockfile - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_qtextstream - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QThread
17-1108
260 QCoreApplicationPrivate::theMainThread = data->thread.load();
executed 1108 times by 18 tests: QCoreApplicationPrivate::theMainThread = data->thread.load();
Executed by:
  • tst_qapplication - unknown status
  • tst_qcoreapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlockfile - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_qtextstream - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
1108
261 }
executed 1125 times by 19 tests: end of block
Executed by:
  • tst_QThread
  • tst_qapplication - unknown status
  • tst_qcoreapplication - unknown status
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbuscpp2xml - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdbusxml2cpp - unknown status
  • tst_qlockfile - unknown status
  • tst_qlogging - unknown status
  • tst_qnetworkreply - unknown status
  • tst_qobject - unknown status
  • tst_qprocess - unknown status
  • tst_qsharedmemory - unknown status
  • tst_qsystemsemaphore - unknown status
  • tst_qtextstream - unknown status
  • tst_quuid - unknown status
  • tst_selftests - unknown status
1125
262 return data;
executed 43687169 times by 1014 tests: return data;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
43687169
263}-
264-
265-
266void QAdoptedThread::init()-
267{-
268}-
269-
270/*-
271 QThreadPrivate-
272*/-
273-
274extern "C" {-
275typedef void*(*QtThreadCallback)(void*);-
276}-
277-
278#endif // QT_NO_THREAD-
279-
280void QThreadPrivate::createEventDispatcher(QThreadData *data)-
281{-
282#if defined(Q_OS_OSX)-
283 bool ok = false;-
284 int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);-
285 if (ok && value > 0)-
286 data->eventDispatcher.storeRelease(new QEventDispatcherCoreFoundation);-
287 else-
288 data->eventDispatcher.storeRelease(new QEventDispatcherUNIX);-
289#elif !defined(QT_NO_GLIB)-
290 if (qEnvironmentVariableIsEmpty("QT_NO_GLIB")
qEnvironmentVa...("QT_NO_GLIB")Description
TRUEevaluated 620684 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEnever evaluated
0-620684
291 && qEnvironmentVariableIsEmpty("QT_NO_THREADED_GLIB")
qEnvironmentVa...HREADED_GLIB")Description
TRUEevaluated 620684 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEnever evaluated
0-620684
292 && QEventDispatcherGlib::versionSupported())
QEventDispatch...ionSupported()Description
TRUEevaluated 620684 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEnever evaluated
0-620684
293 data->eventDispatcher.storeRelease(new QEventDispatcherGlib);
executed 620684 times by 512 tests: data->eventDispatcher.storeRelease(new QEventDispatcherGlib);
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620684
294 else-
295 data->eventDispatcher.storeRelease(new QEventDispatcherUNIX);
never executed: data->eventDispatcher.storeRelease(new QEventDispatcherUNIX);
0
296#else-
297 data->eventDispatcher.storeRelease(new QEventDispatcherUNIX);-
298#endif-
299-
300 data->eventDispatcher.load()->startingUp();-
301}
executed 620684 times by 512 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620684
302-
303#ifndef QT_NO_THREAD-
304-
305#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))-
306static void setCurrentThreadName(pthread_t threadId, const char *name)-
307{-
308# if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)-
309 Q_UNUSED(threadId);-
310 prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0);-
311# elif defined(Q_OS_MAC)-
312 Q_UNUSED(threadId);-
313 pthread_setname_np(name);-
314# elif defined(Q_OS_QNX)-
315 pthread_setname_np(threadId, name);-
316# endif-
317}
executed 620683 times by 512 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620683
318#endif-
319-
320void *QThreadPrivate::start(void *arg)-
321{-
322#if !defined(Q_OS_ANDROID)-
323 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);-
324#endif-
325 pthread_cleanup_push(QThreadPrivate::finish, arg);-
326-
327 QThread *thr = reinterpret_cast<QThread *>(arg);-
328 QThreadData *data = QThreadData::get2(thr);-
329-
330 {-
331 QMutexLocker locker(&thr->d_func()->mutex);-
332-
333 // do we need to reset the thread priority?-
334 if (int(thr->d_func()->priority) & ThreadPriorityResetFlag) {
int(thr->d_fun...orityResetFlagDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QThread
FALSEevaluated 620680 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
3-620680
335 thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag));-
336 }
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QReadWriteLock
  • tst_QThread
3
337-
338 data->threadId = to_HANDLE(pthread_self());-
339 set_thread_data(data);-
340-
341 data->ref();-
342 data->quitNow = thr->d_func()->exited;-
343 }-
344-
345 if (data->eventDispatcher.load()) // custom event dispatcher set?
data->eventDispatcher.load()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QThread
FALSEevaluated 620682 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1-620682
346 data->eventDispatcher.load()->startingUp();
executed 1 time by 1 test: data->eventDispatcher.load()->startingUp();
Executed by:
  • tst_QThread
1
347 else-
348 createEventDispatcher(data);
executed 620682 times by 512 tests: createEventDispatcher(data);
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620682
349-
350#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))-
351 {-
352 // sets the name of the current thread.-
353 QString objectName = thr->objectName();-
354-
355 pthread_t thread_id = from_HANDLE<pthread_t>(data->threadId);-
356 if (Q_LIKELY(objectName.isEmpty()))
__builtin_expe...mpty()), true)Description
TRUEevaluated 618748 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
FALSEevaluated 1935 times by 45 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDBusThreading
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • ...
1935-618748
357 setCurrentThreadName(thread_id, thr->metaObject()->className());
executed 618748 times by 512 tests: setCurrentThreadName(thread_id, thr->metaObject()->className());
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
618748
358 else-
359 setCurrentThreadName(thread_id, objectName.toLocal8Bit());
executed 1935 times by 45 tests: setCurrentThreadName(thread_id, objectName.toLocal8Bit());
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDBusThreading
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QLockFile
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPointer
  • ...
1935
360 }-
361#endif-
362-
363 emit thr->started(QThread::QPrivateSignal());-
364#if !defined(Q_OS_ANDROID)-
365 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);-
366 pthread_testcancel();-
367#endif-
368 thr->run();-
369-
370 pthread_cleanup_pop(1);-
371-
372 return 0;
executed 620181 times by 512 tests: return 0;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFtp
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • tst_QMutex
  • ...
620181
373}-
374-
375void QThreadPrivate::finish(void *arg)-
376{-
377 QThread *thr = reinterpret_cast<QThread *>(arg);-
378 QThreadPrivate *d = thr->d_func();-
379-
380 QMutexLocker locker(&d->mutex);-
381-
382 d->isInFinish = true;-
383 d->priority = QThread::InheritPriority;-
384 void *data = &d->data->tls;-
385 locker.unlock();-
386 emit thr->finished(QThread::QPrivateSignal());-
387 QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);-
388 QThreadStorageData::finish((void **)data);-
389 locker.relock();-
390-
391 QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.load();-
392 if (eventDispatcher) {
eventDispatcherDescription
TRUEevaluated 620844 times by 578 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFtp
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • ...
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QThread
15-620844
393 d->data->eventDispatcher = 0;-
394 locker.unlock();-
395 eventDispatcher->closingDown();-
396 delete eventDispatcher;-
397 locker.relock();-
398 }
executed 620844 times by 578 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFtp
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • ...
620844
399-
400 d->running = false;-
401 d->finished = true;-
402 d->interruptionRequested = false;-
403-
404 d->isInFinish = false;-
405 d->thread_done.wakeAll();-
406}
executed 620859 times by 578 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFtp
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • ...
620859
407-
408-
409-
410-
411/**************************************************************************-
412 ** QThread-
413 *************************************************************************/-
414-
415Qt::HANDLE QThread::currentThreadId() Q_DECL_NOTHROW-
416{-
417 // requires a C cast here otherwise we run into trouble on AIX-
418 return to_HANDLE(pthread_self());
executed 13345982 times by 599 tests: return to_HANDLE(pthread_self());
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QBuffer
  • ...
13345982
419}-
420-
421#if defined(QT_LINUXBASE) && !defined(_SC_NPROCESSORS_ONLN)-
422// LSB doesn't define _SC_NPROCESSORS_ONLN.-
423# define _SC_NPROCESSORS_ONLN 84-
424#endif-
425-
426int QThread::idealThreadCount() Q_DECL_NOTHROW-
427{-
428 int cores = 1;-
429-
430#if defined(Q_OS_HPUX)-
431 // HP-UX-
432 struct pst_dynamic psd;-
433 if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) == -1) {-
434 perror("pstat_getdynamic");-
435 } else {-
436 cores = (int)psd.psd_proc_cnt;-
437 }-
438#elif defined(Q_OS_BSD4)-
439 // FreeBSD, OpenBSD, NetBSD, BSD/OS, OS X, iOS-
440 size_t len = sizeof(cores);-
441 int mib[2];-
442 mib[0] = CTL_HW;-
443 mib[1] = HW_NCPU;-
444 if (sysctl(mib, 2, &cores, &len, NULL, 0) != 0) {-
445 perror("sysctl");-
446 }-
447#elif defined(Q_OS_IRIX)-
448 // IRIX-
449 cores = (int)sysconf(_SC_NPROC_ONLN);-
450#elif defined(Q_OS_INTEGRITY)-
451#if (__INTEGRITY_MAJOR_VERSION >= 10)-
452 // Integrity V10+ does support multicore CPUs-
453 Value processorCount;-
454 if (GetProcessorCount(CurrentTask(), &processorCount) == 0)-
455 cores = processorCount;-
456 else-
457#endif-
458 // as of aug 2008 Integrity only supports one single core CPU-
459 cores = 1;-
460#elif defined(Q_OS_VXWORKS)-
461 // VxWorks-
462# if defined(QT_VXWORKS_HAS_CPUSET)-
463 cpuset_t cpus = vxCpuEnabledGet();-
464 cores = 0;-
465-
466 // 128 cores should be enough for everyone ;)-
467 for (int i = 0; i < 128 && !CPUSET_ISZERO(cpus); ++i) {-
468 if (CPUSET_ISSET(cpus, i)) {-
469 CPUSET_CLR(cpus, i);-
470 cores++;-
471 }-
472 }-
473# else-
474 // as of aug 2008 VxWorks < 6.6 only supports one single core CPU-
475 cores = 1;-
476# endif-
477#else-
478 // the rest: Linux, Solaris, AIX, Tru64-
479 cores = (int)sysconf(_SC_NPROCESSORS_ONLN);-
480 if (cores == -1)
cores == -1Description
TRUEnever evaluated
FALSEevaluated 1903 times by 447 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFreeList
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
0-1903
481 return 1;
never executed: return 1;
0
482#endif-
483 return cores;
executed 1903 times by 447 tests: return cores;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDebug
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFreeList
  • tst_QFtp
  • tst_QFuture
  • tst_QFutureWatcher
  • tst_QGlobal
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QLockFile
  • tst_QMimeDatabase
  • ...
1903
484}-
485-
486void QThread::yieldCurrentThread()-
487{-
488 sched_yield();-
489}
executed 1556 times by 3 tests: end of block
Executed by:
  • tst_QSqlThread
  • tst_QVector
  • tst_QVector_StrictIterators
1556
490-
491static timespec makeTimespec(time_t secs, long nsecs)-
492{-
493 struct timespec ts;-
494 ts.tv_sec = secs;-
495 ts.tv_nsec = nsecs;-
496 return ts;
executed 325374 times by 11 tests: return ts;
Executed by:
  • tst_QDBusAbstractInterface
  • tst_QFuture
  • tst_QLockFile
  • tst_QMutex
  • tst_QProcess
  • tst_QProgressDialog
  • tst_QReadWriteLock
  • tst_QSharedPointer
  • tst_QTcpServer
  • tst_QThread
  • tst_QThreadPool
325374
497}-
498-
499void QThread::sleep(unsigned long secs)-
500{-
501 qt_nanosleep(makeTimespec(secs, 0));-
502}
executed 7 times by 3 tests: end of block
Executed by:
  • tst_QProcess
  • tst_QTcpServer
  • tst_QThread
7
503-
504void QThread::msleep(unsigned long msecs)-
505{-
506 qt_nanosleep(makeTimespec(msecs / 1000, msecs % 1000 * 1000 * 1000));-
507}
executed 295269 times by 8 tests: end of block
Executed by:
  • tst_QDBusAbstractInterface
  • tst_QFuture
  • tst_QLockFile
  • tst_QMutex
  • tst_QProgressDialog
  • tst_QReadWriteLock
  • tst_QThread
  • tst_QThreadPool
295269
508-
509void QThread::usleep(unsigned long usecs)-
510{-
511 qt_nanosleep(makeTimespec(usecs / 1000 / 1000, usecs % (1000*1000) * 1000));-
512}
executed 30079 times by 3 tests: end of block
Executed by:
  • tst_QReadWriteLock
  • tst_QSharedPointer
  • tst_QThread
30079
513-
514#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING-
515// Does some magic and calculate the Unix scheduler priorities-
516// sched_policy is IN/OUT: it must be set to a valid policy before calling this function-
517// sched_priority is OUT only-
518static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority)-
519{-
520#ifdef SCHED_IDLE-
521 if (priority == QThread::IdlePriority) {
priority == QT...::IdlePriorityDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QThread
FALSEevaluated 393 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
8-393
522 *sched_policy = SCHED_IDLE;-
523 *sched_priority = 0;-
524 return true;
executed 8 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QThread
8
525 }-
526 const int lowestPriority = QThread::LowestPriority;-
527#else-
528 const int lowestPriority = QThread::IdlePriority;-
529#endif-
530 const int highestPriority = QThread::TimeCriticalPriority;-
531-
532 int prio_min;-
533 int prio_max;-
534#if defined(Q_OS_VXWORKS) && defined(VXWORKS_DKM)-
535 // for other scheduling policies than SCHED_RR or SCHED_FIFO-
536 prio_min = SCHED_FIFO_LOW_PRI;-
537 prio_max = SCHED_FIFO_HIGH_PRI;-
538-
539 if ((*sched_policy == SCHED_RR) || (*sched_policy == SCHED_FIFO))-
540#endif-
541 {-
542 prio_min = sched_get_priority_min(*sched_policy);-
543 prio_max = sched_get_priority_max(*sched_policy);-
544 }-
545-
546 if (prio_min == -1 || prio_max == -1)
prio_min == -1Description
TRUEnever evaluated
FALSEevaluated 393 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
prio_max == -1Description
TRUEnever evaluated
FALSEevaluated 393 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
0-393
547 return false;
never executed: return false;
0
548-
549 int prio;-
550 // crudely scale our priority enum values to the prio_min/prio_max-
551 prio = ((priority - lowestPriority) * (prio_max - prio_min) / highestPriority) + prio_min;-
552 prio = qMax(prio_min, qMin(prio_max, prio));-
553-
554 *sched_priority = prio;-
555 return true;
executed 393 times by 10 tests: return true;
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
393
556}-
557#endif-
558-
559void QThread::start(Priority priority)-
560{-
561 Q_D(QThread);-
562 QMutexLocker locker(&d->mutex);-
563-
564 if (d->isInFinish)
d->isInFinishDescription
TRUEnever evaluated
FALSEevaluated 620683 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-620683
565 d->thread_done.wait(locker.mutex());
never executed: d->thread_done.wait(locker.mutex());
0
566-
567 if (d->running)
d->runningDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileDialog2
FALSEevaluated 620682 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1-620682
568 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QFileDialog2
1
569-
570 d->running = true;-
571 d->finished = false;-
572 d->returnCode = 0;-
573 d->exited = false;-
574 d->interruptionRequested = false;-
575-
576 pthread_attr_t attr;-
577 pthread_attr_init(&attr);-
578 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);-
579-
580 d->priority = priority;-
581-
582#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING)-
583 switch (priority) {-
584 case InheritPriority:
executed 620298 times by 512 tests: case InheritPriority:
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620298
585 {-
586 pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);-
587 break;
executed 620298 times by 512 tests: break;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620298
588 }-
589-
590 default:
executed 384 times by 10 tests: default:
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
384
591 {-
592 int sched_policy;-
593 if (pthread_attr_getschedpolicy(&attr, &sched_policy) != 0) {
pthread_attr_g...d_policy) != 0Description
TRUEnever evaluated
FALSEevaluated 384 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
0-384
594 // failed to get the scheduling policy, don't bother-
595 // setting the priority-
596 qWarning("QThread::start: Cannot determine default scheduler policy");-
597 break;
never executed: break;
0
598 }-
599-
600 int prio;-
601 if (!calculateUnixPriority(priority, &sched_policy, &prio)) {
!calculateUnix...policy, &prio)Description
TRUEnever evaluated
FALSEevaluated 384 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
0-384
602 // failed to get the scheduling parameters, don't-
603 // bother setting the priority-
604 qWarning("QThread::start: Cannot determine scheduler priority range");-
605 break;
never executed: break;
0
606 }-
607-
608 sched_param sp;-
609 sp.sched_priority = prio;-
610-
611 if (pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) != 0
pthread_attr_s...IT_SCHED) != 0Description
TRUEnever evaluated
FALSEevaluated 384 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
0-384
612 || pthread_attr_setschedpolicy(&attr, sched_policy) != 0
pthread_attr_s...d_policy) != 0Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QThread
FALSEevaluated 381 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
3-381
613 || pthread_attr_setschedparam(&attr, &sp) != 0) {
pthread_attr_s...ttr, &sp) != 0Description
TRUEnever evaluated
FALSEevaluated 381 times by 10 tests
Evaluated by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
0-381
614 // could not set scheduling hints, fallback to inheriting them-
615 // we'll try again from inside the thread-
616 pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);-
617 d->priority = Priority(priority | ThreadPriorityResetFlag);-
618 }
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QReadWriteLock
  • tst_QThread
3
619 break;
executed 384 times by 10 tests: break;
Executed by:
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QPrinter
  • tst_QReadWriteLock
  • tst_QSidebar
  • tst_QThread
  • tst_languageChange
384
620 }-
621 }-
622#endif // QT_HAS_THREAD_PRIORITY_SCHEDULING-
623-
624-
625 if (d->stackSize > 0) {
d->stackSize > 0Description
TRUEnever evaluated
FALSEevaluated 620682 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-620682
626#if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0 > 0)-
627 int code = pthread_attr_setstacksize(&attr, d->stackSize);-
628#else-
629 int code = ENOSYS; // stack size not supported, automatically fail-
630#endif // _POSIX_THREAD_ATTR_STACKSIZE-
631-
632 if (code) {
codeDescription
TRUEnever evaluated
FALSEnever evaluated
0
633 qWarning("QThread::start: Thread stack size error: %s",-
634 qPrintable(qt_error_string(code)));-
635-
636 // we failed to set the stacksize, and as the documentation states,-
637 // the thread will fail to run...-
638 d->running = false;-
639 d->finished = false;-
640 return;
never executed: return;
0
641 }-
642 }
never executed: end of block
0
643-
644 pthread_t threadId;-
645 int code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);-
646 if (code == EPERM) {
code == 1Description
TRUEnever evaluated
FALSEevaluated 620682 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-620682
647 // caller does not have permission to set the scheduling-
648 // parameters/policy-
649#if defined(QT_HAS_THREAD_PRIORITY_SCHEDULING)-
650 pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);-
651#endif-
652 code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);-
653 }
never executed: end of block
0
654 d->data->threadId = to_HANDLE(threadId);-
655-
656 pthread_attr_destroy(&attr);-
657-
658 if (code) {
codeDescription
TRUEnever evaluated
FALSEevaluated 620682 times by 512 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
0-620682
659 qWarning("QThread::start: Thread creation error: %s", qPrintable(qt_error_string(code)));-
660-
661 d->running = false;-
662 d->finished = false;-
663 d->data->threadId = 0;-
664 }
never executed: end of block
0
665}
executed 620682 times by 512 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
620682
666-
667void QThread::terminate()-
668{-
669#if !defined(Q_OS_ANDROID)-
670 Q_D(QThread);-
671 QMutexLocker locker(&d->mutex);-
672-
673 if (!d->data->threadId)
!d->data->threadIdDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThread
0-2
674 return;
never executed: return;
0
675-
676 int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId));-
677 if (code) {
codeDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThread
0-2
678 qWarning("QThread::start: Thread termination error: %s",-
679 qPrintable(qt_error_string((code))));-
680 }
never executed: end of block
0
681#endif-
682}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QThread
2
683-
684bool QThread::wait(unsigned long time)-
685{-
686 Q_D(QThread);-
687 QMutexLocker locker(&d->mutex);-
688-
689 if (from_HANDLE<pthread_t>(d->data->threadId) == pthread_self()) {
from_HANDLE<pt...pthread_self()Description
TRUEnever evaluated
FALSEevaluated 620107 times by 575 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
0-620107
690 qWarning("QThread::wait: Thread tried to wait on itself");-
691 return false;
never executed: return false;
0
692 }-
693-
694 if (d->finished || !d->running)
d->finishedDescription
TRUEevaluated 6717 times by 427 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCompleter
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaType
  • tst_QMutex
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPainter
  • tst_QPrinter
  • tst_QProcess
  • tst_QReadWriteLock
  • tst_QRegExp
  • tst_QSemaphore
  • tst_QSettings
  • ...
FALSEevaluated 613390 times by 252 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
!d->runningDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QSharedMemory
FALSEevaluated 613380 times by 252 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
10-613390
695 return true;
executed 6727 times by 428 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCompleter
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QHostInfo
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaType
  • tst_QMutex
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QObject
  • tst_QPainter
  • tst_QPrinter
  • tst_QProcess
  • tst_QReadWriteLock
  • tst_QRegExp
  • tst_QSemaphore
  • tst_QSettings
  • ...
6727
696-
697 while (d->running) {
d->runningDescription
TRUEevaluated 613380 times by 252 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
FALSEevaluated 613307 times by 252 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
613307-613380
698 if (!d->thread_done.wait(locker.mutex(), time))
!d->thread_don...mutex(), time)Description
TRUEevaluated 73 times by 4 tests
Evaluated by:
  • tst_QMutex
  • tst_QThread
  • tst_QThreadPool
  • tst_QWaitCondition
FALSEevaluated 613307 times by 252 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
73-613307
699 return false;
executed 73 times by 4 tests: return false;
Executed by:
  • tst_QMutex
  • tst_QThread
  • tst_QThreadPool
  • tst_QWaitCondition
73
700 }
executed 613307 times by 252 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
613307
701 return true;
executed 613307 times by 252 tests: return true;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QAtomicInt
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusAbstractInterface
  • tst_QDBusPendingCall
  • tst_QDBusThreading
  • tst_QDnsLookup_Appless
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFreeList
  • tst_QFuture
  • tst_QGlobalStatic
  • tst_QGraphicsProxyWidget
  • tst_QGuiApplication
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QLocalSocket
  • tst_QLogging
  • tst_QMetaObject
  • tst_QMetaType
  • ...
613307
702}-
703-
704void QThread::setTerminationEnabled(bool enabled)-
705{-
706 QThread *thr = currentThread();-
707 Q_ASSERT_X(thr != 0, "QThread::setTerminationEnabled()",-
708 "Current thread was not started with QThread.");-
709-
710 Q_UNUSED(thr)-
711#if defined(Q_OS_ANDROID)-
712 Q_UNUSED(enabled);-
713#else-
714 pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL);-
715 if (enabled)
enabledDescription
TRUEevaluated 166 times by 2 tests
Evaluated by:
  • tst_QThread
  • tst_QWaitCondition
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QThread
2-166
716 pthread_testcancel();
executed 166 times by 2 tests: pthread_testcancel();
Executed by:
  • tst_QThread
  • tst_QWaitCondition
166
717#endif-
718}
executed 166 times by 2 tests: end of block
Executed by:
  • tst_QThread
  • tst_QWaitCondition
166
719-
720// Caller must lock the mutex-
721void QThreadPrivate::setPriority(QThread::Priority threadPriority)-
722{-
723 priority = threadPriority;-
724-
725 // copied from start() with a few modifications:-
726-
727#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING-
728 int sched_policy;-
729 sched_param param;-
730-
731 if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, &param) != 0) {
pthread_getsch..., &param) != 0Description
TRUEnever evaluated
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QThread
0-17
732 // failed to get the scheduling policy, don't bother setting-
733 // the priority-
734 qWarning("QThread::setPriority: Cannot get scheduler parameters");-
735 return;
never executed: return;
0
736 }-
737-
738 int prio;-
739 if (!calculateUnixPriority(priority, &sched_policy, &prio)) {
!calculateUnix...policy, &prio)Description
TRUEnever evaluated
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QThread
0-17
740 // failed to get the scheduling parameters, don't-
741 // bother setting the priority-
742 qWarning("QThread::setPriority: Cannot determine scheduler priority range");-
743 return;
never executed: return;
0
744 }-
745-
746 param.sched_priority = prio;-
747 int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, &param);-
748-
749# ifdef SCHED_IDLE-
750 // were we trying to set to idle priority and failed?-
751 if (status == -1 && sched_policy == SCHED_IDLE && errno == EINVAL) {
status == -1Description
TRUEnever evaluated
FALSEevaluated 17 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QThread
sched_policy == 5Description
TRUEnever evaluated
FALSEnever evaluated
(*__errno_location ()) == 22Description
TRUEnever evaluated
FALSEnever evaluated
0-17
752 // reset to lowest priority possible-
753 pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId), &sched_policy, &param);-
754 param.sched_priority = sched_get_priority_min(sched_policy);-
755 pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId), sched_policy, &param);-
756 }
never executed: end of block
0
757# else-
758 Q_UNUSED(status);-
759# endif // SCHED_IDLE-
760#endif-
761}
executed 17 times by 2 tests: end of block
Executed by:
  • tst_QReadWriteLock
  • tst_QThread
17
762-
763#endif // QT_NO_THREAD-
764-
765QT_END_NAMESPACE-
766-
Source codeSwitch to Preprocessed file

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