Modernize the "thread" feature
Add it to configure.json and replace all occurrences of QT_NO_THREAD with QT_CONFIG(thread). Add conditions for other features that depend on thread support. Remove conditions where we can use the QMutex and QThreadStorage stubs. Change-Id: I284e5d794fda9a4c6f4a1ab29e55aa686272a0eb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
815153d4a4
commit
0a06e1baf9
@ -1106,10 +1106,17 @@
|
||||
"condition": "libs.zlib",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"thread": {
|
||||
"label": "Thread support",
|
||||
"purpose": "Provides QThread and related classes.",
|
||||
"section": "Kernel",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"future": {
|
||||
"label": "QFuture",
|
||||
"purpose": "Provides QFuture and related classes.",
|
||||
"section": "Kernel",
|
||||
"condition": "features.thread",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"concurrent": {
|
||||
@ -1122,6 +1129,7 @@
|
||||
"dbus": {
|
||||
"label": "Qt D-Bus",
|
||||
"autoDetect": "!config.uikit && !config.android && !config.winrt",
|
||||
"condition": "features.thread",
|
||||
"output": [ "privateFeature", "feature" ]
|
||||
},
|
||||
"dbus-linked": {
|
||||
@ -1153,10 +1161,12 @@
|
||||
},
|
||||
"network": {
|
||||
"label": "Qt Network",
|
||||
"condition": "features.thread",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"sql": {
|
||||
"label": "Qt Sql",
|
||||
"condition": "features.thread",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"testlib": {
|
||||
|
@ -215,9 +215,7 @@ typedef QList<QAbstractAnimation*>::ConstIterator AnimationListConstIt;
|
||||
QUnifiedTimer drives animations indirectly, via QAbstractAnimationTimer.
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
Q_GLOBAL_STATIC(QThreadStorage<QUnifiedTimer *>, unifiedTimer)
|
||||
#endif
|
||||
|
||||
QUnifiedTimer::QUnifiedTimer() :
|
||||
QObject(), defaultDriver(this), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
|
||||
@ -234,18 +232,12 @@ QUnifiedTimer::QUnifiedTimer() :
|
||||
QUnifiedTimer *QUnifiedTimer::instance(bool create)
|
||||
{
|
||||
QUnifiedTimer *inst;
|
||||
#ifndef QT_NO_THREAD
|
||||
if (create && !unifiedTimer()->hasLocalData()) {
|
||||
inst = new QUnifiedTimer;
|
||||
unifiedTimer()->setLocalData(inst);
|
||||
} else {
|
||||
inst = unifiedTimer() ? unifiedTimer()->localData() : 0;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(create);
|
||||
static QUnifiedTimer unifiedTimer;
|
||||
inst = &unifiedTimer;
|
||||
#endif
|
||||
return inst;
|
||||
}
|
||||
|
||||
@ -554,7 +546,7 @@ bool QUnifiedTimer::canUninstallAnimationDriver(QAnimationDriver *d)
|
||||
return d == driver && driver != &defaultDriver;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
Q_GLOBAL_STATIC(QThreadStorage<QAnimationTimer *>, animationTimer)
|
||||
#endif
|
||||
|
||||
@ -569,7 +561,7 @@ QAnimationTimer::QAnimationTimer() :
|
||||
QAnimationTimer *QAnimationTimer::instance(bool create)
|
||||
{
|
||||
QAnimationTimer *inst;
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
if (create && !animationTimer()->hasLocalData()) {
|
||||
inst = new QAnimationTimer;
|
||||
animationTimer()->setLocalData(inst);
|
||||
|
@ -115,7 +115,7 @@
|
||||
#define QT_NO_SYSTEMLOCALE
|
||||
#define QT_FEATURE_systemsemaphore -1
|
||||
#define QT_FEATURE_temporaryfile 1
|
||||
#define QT_NO_THREAD
|
||||
#define QT_FEATURE_thread -1
|
||||
#define QT_FEATURE_timezone -1
|
||||
#define QT_FEATURE_topleveldomain -1
|
||||
#define QT_NO_TRANSLATION
|
||||
|
@ -53,10 +53,6 @@
|
||||
|
||||
#include <qmutex.h>
|
||||
|
||||
#ifndef QT_NO_QOBJECT
|
||||
#include <private/qthread_p.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -55,7 +55,7 @@ enum GuardValues {
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(QT_NO_THREAD) || defined(Q_COMPILER_THREADSAFE_STATICS)
|
||||
#if !QT_CONFIG(thread) || defined(Q_COMPILER_THREADSAFE_STATICS)
|
||||
// some compilers support thread-safe statics
|
||||
// The IA-64 C++ ABI requires this, so we know that all GCC versions since 3.4
|
||||
// support it. C++11 also requires this behavior.
|
||||
|
@ -264,7 +264,7 @@
|
||||
[stmt.decl], but as of the time of this writing, only compilers based on
|
||||
the IA-64 C++ ABI implemented it properly. The implementation requiring
|
||||
thread-safe initialization is also used on the Qt bootstrapped tools, which
|
||||
define QT_NO_THREAD.
|
||||
disable the "thread" feature.
|
||||
|
||||
The implementation requiring thread-safe initialization from the compiler
|
||||
is the simplest: it creates the \a Type object as a function-local static
|
||||
|
@ -1298,7 +1298,7 @@ struct QRandEngine
|
||||
};
|
||||
}
|
||||
|
||||
#if defined(QT_NO_THREAD) || defined(Q_OS_WIN)
|
||||
#if defined(Q_OS_WIN)
|
||||
// On Windows srand() and rand() already use Thread-Local-Storage
|
||||
// to store the seed between calls
|
||||
static inline QRandEngine *randTLS()
|
||||
|
@ -853,7 +853,7 @@ QByteArray QFileSystemEngine::id(int id)
|
||||
//static
|
||||
QString QFileSystemEngine::resolveUserName(uint userId)
|
||||
{
|
||||
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
||||
int size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||
if (size_max == -1)
|
||||
size_max = 1024;
|
||||
@ -862,7 +862,7 @@ QString QFileSystemEngine::resolveUserName(uint userId)
|
||||
|
||||
#if !defined(Q_OS_INTEGRITY)
|
||||
struct passwd *pw = 0;
|
||||
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS)
|
||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS)
|
||||
struct passwd entry;
|
||||
getpwuid_r(userId, &entry, buf.data(), buf.size(), &pw);
|
||||
#else
|
||||
@ -877,7 +877,7 @@ QString QFileSystemEngine::resolveUserName(uint userId)
|
||||
//static
|
||||
QString QFileSystemEngine::resolveGroupName(uint groupId)
|
||||
{
|
||||
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
|
||||
int size_max = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||
if (size_max == -1)
|
||||
size_max = 1024;
|
||||
@ -886,7 +886,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId)
|
||||
|
||||
#if !defined(Q_OS_INTEGRITY)
|
||||
struct group *gr = 0;
|
||||
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
|
||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
|
||||
size_max = sysconf(_SC_GETGR_R_SIZE_MAX);
|
||||
if (size_max == -1)
|
||||
size_max = 1024;
|
||||
|
@ -45,7 +45,6 @@
|
||||
|
||||
#include "qfile.h"
|
||||
#include "qdir.h"
|
||||
#include "private/qmutexpool_p.h"
|
||||
#include "qvarlengtharray.h"
|
||||
#include "qdatetime.h"
|
||||
#include "qt_windows.h"
|
||||
|
@ -101,7 +101,6 @@ QT_END_NAMESPACE
|
||||
#include <qdir.h>
|
||||
#include <qlist.h>
|
||||
#include <qmutex.h>
|
||||
#include <qsemaphore.h>
|
||||
#include <qsocketnotifier.h>
|
||||
#include <qthread.h>
|
||||
#include <qelapsedtimer.h>
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
#include "qhash.h"
|
||||
#include "qpair.h"
|
||||
#include "qmutex.h"
|
||||
#include "qvarlengtharray.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -58,9 +58,11 @@
|
||||
#include <qtextcodec.h>
|
||||
#ifndef QT_NO_QOBJECT
|
||||
#include <qthread.h>
|
||||
#include <qthreadpool.h>
|
||||
#include <qthreadstorage.h>
|
||||
#include <private/qthread_p.h>
|
||||
#if QT_CONFIG(thread)
|
||||
#include <qthreadpool.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <qelapsedtimer.h>
|
||||
#include <qlibraryinfo.h>
|
||||
@ -268,9 +270,7 @@ typedef QList<QtStartUpFunction> QStartUpFuncList;
|
||||
Q_GLOBAL_STATIC(QStartUpFuncList, preRList)
|
||||
typedef QList<QtCleanUpFunction> QVFuncList;
|
||||
Q_GLOBAL_STATIC(QVFuncList, postRList)
|
||||
#ifndef QT_NO_QOBJECT
|
||||
static QBasicMutex globalRoutinesMutex;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\internal
|
||||
@ -289,9 +289,7 @@ void qAddPreRoutine(QtStartUpFunction p)
|
||||
|
||||
// Due to C++11 parallel dynamic initialization, this can be called
|
||||
// from multiple threads.
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(&globalRoutinesMutex);
|
||||
#endif
|
||||
list->prepend(p); // in case QCoreApplication is re-created, see qt_call_pre_routines
|
||||
}
|
||||
|
||||
@ -300,9 +298,7 @@ void qAddPostRoutine(QtCleanUpFunction p)
|
||||
QVFuncList *list = postRList();
|
||||
if (!list)
|
||||
return;
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(&globalRoutinesMutex);
|
||||
#endif
|
||||
list->prepend(p);
|
||||
}
|
||||
|
||||
@ -311,9 +307,7 @@ void qRemovePostRoutine(QtCleanUpFunction p)
|
||||
QVFuncList *list = postRList();
|
||||
if (!list)
|
||||
return;
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(&globalRoutinesMutex);
|
||||
#endif
|
||||
list->removeAll(p);
|
||||
}
|
||||
|
||||
@ -324,9 +318,7 @@ static void qt_call_pre_routines()
|
||||
|
||||
QVFuncList list;
|
||||
{
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(&globalRoutinesMutex);
|
||||
#endif
|
||||
// Unlike qt_call_post_routines, we don't empty the list, because
|
||||
// Q_COREAPP_STARTUP_FUNCTION is a macro, so the user expects
|
||||
// the function to be executed every time QCoreApplication is created.
|
||||
@ -345,9 +337,7 @@ void Q_CORE_EXPORT qt_call_post_routines()
|
||||
QVFuncList list;
|
||||
{
|
||||
// extract the current list and make the stored list empty
|
||||
#ifndef QT_NO_THREAD
|
||||
QMutexLocker locker(&globalRoutinesMutex);
|
||||
#endif
|
||||
qSwap(*postRList, list);
|
||||
}
|
||||
|
||||
@ -513,7 +503,7 @@ QCoreApplicationPrivate::~QCoreApplicationPrivate()
|
||||
void QCoreApplicationPrivate::cleanupThreadData()
|
||||
{
|
||||
if (threadData && !threadData_clean) {
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
void *data = &threadData->tls;
|
||||
QThreadStorageData::finish((void **)data);
|
||||
#endif
|
||||
@ -888,7 +878,7 @@ QCoreApplication::~QCoreApplication()
|
||||
QCoreApplicationPrivate::is_app_running = false;
|
||||
#endif
|
||||
|
||||
#if !defined(QT_NO_THREAD)
|
||||
#if QT_CONFIG(thread)
|
||||
// Synchronize and stop the global thread pool threads.
|
||||
QThreadPool *globalThreadPool = 0;
|
||||
QT_TRY {
|
||||
|
@ -50,7 +50,9 @@
|
||||
#include <qthread.h>
|
||||
#include <qvariant.h>
|
||||
#include <qdebug.h>
|
||||
#if QT_CONFIG(thread)
|
||||
#include <qsemaphore.h>
|
||||
#endif
|
||||
|
||||
#include "private/qobject_p.h"
|
||||
#include "private/qmetaobject_p.h"
|
||||
@ -1540,14 +1542,14 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
|
||||
|
||||
QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, 1, types, args));
|
||||
} else if (type == Qt::BlockingQueuedConnection) {
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
if (currentThread == objectThread)
|
||||
qWarning("QMetaObject::invokeMethod: Dead lock detected");
|
||||
|
||||
QSemaphore semaphore;
|
||||
QCoreApplication::postEvent(object, new QMetaCallEvent(slot, 0, -1, 0, 0, argv, &semaphore));
|
||||
semaphore.acquire();
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
} else {
|
||||
qWarning("QMetaObject::invokeMethod: Unknown connection type");
|
||||
return false;
|
||||
@ -2272,7 +2274,7 @@ bool QMetaMethod::invoke(QObject *object,
|
||||
: Qt::QueuedConnection;
|
||||
}
|
||||
|
||||
#ifdef QT_NO_THREAD
|
||||
#if !QT_CONFIG(thread)
|
||||
if (connectionType == Qt::BlockingQueuedConnection) {
|
||||
connectionType = Qt::DirectConnection;
|
||||
}
|
||||
@ -2348,7 +2350,7 @@ bool QMetaMethod::invoke(QObject *object,
|
||||
QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction,
|
||||
0, -1, nargs, types, args));
|
||||
} else { // blocking queued connection
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
if (currentThread == objectThread) {
|
||||
qWarning("QMetaMethod::invoke: Dead lock detected in "
|
||||
"BlockingQueuedConnection: Receiver is %s(%p)",
|
||||
@ -2359,7 +2361,7 @@ bool QMetaMethod::invoke(QObject *object,
|
||||
QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction,
|
||||
0, -1, 0, 0, param, &semaphore));
|
||||
semaphore.acquire();
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -59,7 +59,9 @@
|
||||
#include <qpair.h>
|
||||
#include <qvarlengtharray.h>
|
||||
#include <qset.h>
|
||||
#if QT_CONFIG(thread)
|
||||
#include <qsemaphore.h>
|
||||
#endif
|
||||
#include <qsharedpointer.h>
|
||||
|
||||
#include <private/qorderedmutexlocker_p.h>
|
||||
@ -488,7 +490,7 @@ QMetaCallEvent::~QMetaCallEvent()
|
||||
free(types_);
|
||||
free(args_);
|
||||
}
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
if (semaphore_)
|
||||
semaphore_->release();
|
||||
#endif
|
||||
@ -3727,7 +3729,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
|
||||
|| (c->connectionType == Qt::QueuedConnection)) {
|
||||
queued_activate(sender, signal_index, c, argv ? argv : empty_argv, locker);
|
||||
continue;
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
} else if (c->connectionType == Qt::BlockingQueuedConnection) {
|
||||
if (receiverInSameThread) {
|
||||
qWarning("Qt: Dead lock detected while activating a BlockingQueuedConnection: "
|
||||
|
@ -49,7 +49,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
|
||||
#if !defined(Q_OS_WIN) && QT_CONFIG(thread) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
|
||||
defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
|
||||
namespace {
|
||||
// There are two incompatible versions of strerror_r:
|
||||
@ -130,7 +130,7 @@ static QString standardLibraryErrorString(int errorCode)
|
||||
s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
|
||||
break;
|
||||
default: {
|
||||
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
|
||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
|
||||
QByteArray buf(1024, Qt::Uninitialized);
|
||||
ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
|
||||
#else
|
||||
|
@ -42,8 +42,6 @@
|
||||
#include "qplatformdefs.h"
|
||||
#include "qmutex.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qatomic.h"
|
||||
#include "qelapsedtimer.h"
|
||||
#include "qthread.h"
|
||||
@ -739,5 +737,3 @@ QT_END_NAMESPACE
|
||||
#else
|
||||
# include "qmutex_unix.cpp"
|
||||
#endif
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -54,7 +54,7 @@ class tst_QMutex;
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#if !defined(QT_NO_THREAD) || defined(Q_CLANG_QDOC)
|
||||
#if QT_CONFIG(thread) || defined(Q_CLANG_QDOC)
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
# define QT_MUTEX_LOCK_NOEXCEPT Q_DECL_NOTHROW
|
||||
@ -250,7 +250,7 @@ private:
|
||||
quintptr val;
|
||||
};
|
||||
|
||||
#else // QT_NO_THREAD && !Q_CLANG_QDOC
|
||||
#else // !QT_CONFIG(thread) && !Q_CLANG_QDOC
|
||||
|
||||
class Q_CORE_EXPORT QMutex
|
||||
{
|
||||
@ -301,7 +301,7 @@ private:
|
||||
|
||||
typedef QMutex QBasicMutex;
|
||||
|
||||
#endif // QT_NO_THREAD && !Q_CLANG_QDOC
|
||||
#endif // !QT_CONFIG(thread) && !Q_CLANG_QDOC
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -40,8 +40,6 @@
|
||||
|
||||
#include "qplatformdefs.h"
|
||||
#include "qmutex.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qatomic.h"
|
||||
#include "qmutex_p.h"
|
||||
#include "qfutex_p.h"
|
||||
@ -54,7 +52,6 @@
|
||||
# define FUTEX_PRIVATE_FLAG 0
|
||||
#endif
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace QtFutex;
|
||||
@ -183,5 +180,3 @@ void QBasicMutex::unlockInternal() Q_DECL_NOTHROW
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -39,9 +39,6 @@
|
||||
|
||||
#include "qplatformdefs.h"
|
||||
#include "qmutex.h"
|
||||
|
||||
#if !defined(QT_NO_THREAD)
|
||||
|
||||
#include "qmutex_p.h"
|
||||
|
||||
#include <mach/mach.h>
|
||||
@ -89,5 +86,3 @@ void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif //QT_NO_THREAD
|
||||
|
@ -42,8 +42,6 @@
|
||||
#include "qmutex.h"
|
||||
#include "qstring.h"
|
||||
#include "qelapsedtimer.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qatomic.h"
|
||||
#include "qmutex_p.h"
|
||||
#include <errno.h>
|
||||
@ -159,5 +157,3 @@ void QMutexPrivate::wakeUp() Q_DECL_NOTHROW
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -40,8 +40,6 @@
|
||||
#include "qatomic.h"
|
||||
#include "qmutexpool_p.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive))
|
||||
@ -148,5 +146,3 @@ QMutex *QMutexPool::globalInstanceGet(const void *address)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "QtCore/qmutex.h"
|
||||
#include "QtCore/qvarlengtharray.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
QT_REQUIRE_CONFIG(thread);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -85,6 +85,4 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
#endif // QMUTEXPOOL_P_H
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "qplatformdefs.h"
|
||||
#include "qreadwritelock.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qmutex.h"
|
||||
#include "qthread.h"
|
||||
#include "qwaitcondition.h"
|
||||
@ -781,5 +780,3 @@ void QReadWriteLockPrivate::release()
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -45,7 +45,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
class QReadWriteLockPrivate;
|
||||
|
||||
@ -174,7 +174,7 @@ inline QWriteLocker::QWriteLocker(QReadWriteLock *areadWriteLock)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#else // QT_NO_THREAD
|
||||
#else // QT_CONFIG(thread)
|
||||
|
||||
class Q_CORE_EXPORT QReadWriteLock
|
||||
{
|
||||
@ -225,7 +225,7 @@ private:
|
||||
Q_DISABLE_COPY(QWriteLocker)
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qwaitcondition.h>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
QT_REQUIRE_CONFIG(thread);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -99,6 +99,4 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
#endif // QREADWRITELOCK_P_H
|
||||
|
@ -39,8 +39,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qsemaphore.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qmutex.h"
|
||||
#include "qfutex_p.h"
|
||||
#include "qwaitcondition.h"
|
||||
@ -646,5 +644,3 @@ bool QSemaphore::tryAcquire(int n, int timeout)
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -42,11 +42,10 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(thread);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
class QSemaphorePrivate;
|
||||
|
||||
class Q_CORE_EXPORT QSemaphore
|
||||
@ -113,8 +112,6 @@ private:
|
||||
int m_n;
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QSEMAPHORE_H
|
||||
|
@ -103,7 +103,7 @@ QThreadData::~QThreadData()
|
||||
|
||||
void QThreadData::ref()
|
||||
{
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
(void) _ref.ref();
|
||||
Q_ASSERT(_ref.load() != 0);
|
||||
#endif
|
||||
@ -111,7 +111,7 @@ void QThreadData::ref()
|
||||
|
||||
void QThreadData::deref()
|
||||
{
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
if (!_ref.deref())
|
||||
delete this;
|
||||
#endif
|
||||
@ -134,7 +134,7 @@ QAdoptedThread::QAdoptedThread(QThreadData *data)
|
||||
{
|
||||
// thread should be running and not finished for the lifetime
|
||||
// of the application (even if QCoreApplication goes away)
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
d_func()->running = true;
|
||||
d_func()->finished = false;
|
||||
init();
|
||||
@ -148,7 +148,7 @@ QAdoptedThread::~QAdoptedThread()
|
||||
// fprintf(stderr, "~QAdoptedThread = %p\n", this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
void QAdoptedThread::run()
|
||||
{
|
||||
// this function should never be called
|
||||
@ -756,7 +756,7 @@ int QThread::loopLevel() const
|
||||
return d->data->eventLoops.size();
|
||||
}
|
||||
|
||||
#else // QT_NO_THREAD
|
||||
#else // QT_CONFIG(thread)
|
||||
|
||||
QThread::QThread(QObject *parent)
|
||||
: QObject(*(new QThreadPrivate), parent)
|
||||
@ -813,7 +813,7 @@ QThreadPrivate::~QThreadPrivate()
|
||||
delete data;
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
/*!
|
||||
\since 5.0
|
||||
@ -850,7 +850,7 @@ void QThread::setEventDispatcher(QAbstractEventDispatcher *eventDispatcher)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
@ -1015,7 +1015,7 @@ QDaemonThread::~QDaemonThread()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -66,7 +66,7 @@ class QThreadData;
|
||||
class QThreadPrivate;
|
||||
class QAbstractEventDispatcher;
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
class Q_CORE_EXPORT QThread : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -239,7 +239,7 @@ QThread *QThread::create(Function &&f)
|
||||
|
||||
#endif // QT_CONFIG(cxx11_future)
|
||||
|
||||
#else // QT_NO_THREAD
|
||||
#else // QT_CONFIG(thread)
|
||||
|
||||
class Q_CORE_EXPORT QThread : public QObject
|
||||
{
|
||||
@ -267,7 +267,7 @@ private:
|
||||
Q_DECLARE_PRIVATE(QThread)
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -57,7 +57,9 @@
|
||||
#include "QtCore/qthread.h"
|
||||
#include "QtCore/qmutex.h"
|
||||
#include "QtCore/qstack.h"
|
||||
#if QT_CONFIG(thread)
|
||||
#include "QtCore/qwaitcondition.h"
|
||||
#endif
|
||||
#include "QtCore/qmap.h"
|
||||
#include "QtCore/qcoreapplication.h"
|
||||
#include "private/qobject_p.h"
|
||||
@ -141,7 +143,7 @@ private:
|
||||
using QVector<QPostEvent>::insert;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
class Q_CORE_EXPORT QDaemonThread : public QThread
|
||||
{
|
||||
@ -210,7 +212,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#else // QT_NO_THREAD
|
||||
#else // QT_CONFIG(thread)
|
||||
|
||||
class QThreadPrivate : public QObjectPrivate
|
||||
{
|
||||
@ -231,7 +233,7 @@ public:
|
||||
Q_DECLARE_PUBLIC(QThread)
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
class QThreadData
|
||||
{
|
||||
@ -327,7 +329,7 @@ public:
|
||||
void init();
|
||||
|
||||
private:
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
void run() override;
|
||||
#endif
|
||||
};
|
||||
|
@ -103,7 +103,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE));
|
||||
|
||||
@ -270,7 +270,7 @@ extern "C" {
|
||||
typedef void*(*QtThreadCallback)(void*);
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *data)
|
||||
{
|
||||
@ -295,7 +295,7 @@ QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *dat
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))
|
||||
static void setCurrentThreadName(const char *name)
|
||||
@ -513,7 +513,7 @@ void QThread::yieldCurrentThread()
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
static timespec makeTimespec(time_t secs, long nsecs)
|
||||
{
|
||||
@ -538,7 +538,7 @@ void QThread::usleep(unsigned long usecs)
|
||||
qt_nanosleep(makeTimespec(usecs / 1000 / 1000, usecs % (1000*1000) * 1000));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING
|
||||
#if defined(Q_OS_QNX)
|
||||
@ -839,7 +839,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
#ifdef Q_OS_WINRT
|
||||
inline DWORD qWinRTTlsAlloc() {
|
||||
@ -330,7 +330,7 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName)
|
||||
** QThreadPrivate
|
||||
*************************************************************************/
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *data)
|
||||
{
|
||||
@ -342,7 +342,7 @@ QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *dat
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(void *arg) Q_DECL_NOEXCEPT
|
||||
{
|
||||
@ -444,7 +444,7 @@ void QThread::yieldCurrentThread()
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
void QThread::sleep(unsigned long secs)
|
||||
{
|
||||
@ -461,7 +461,7 @@ void QThread::usleep(unsigned long usecs)
|
||||
::Sleep((usecs / 1000) + 1);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
void QThread::start(Priority priority)
|
||||
{
|
||||
@ -699,6 +699,6 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -43,8 +43,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_GLOBAL_STATIC(QThreadPool, theInstance)
|
||||
@ -730,5 +728,3 @@ void QThreadPool::cancel(QRunnable *runnable)
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qthreadpool.cpp"
|
||||
|
||||
#endif
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <QtCore/qthread.h>
|
||||
#include <QtCore/qrunnable.h>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
QT_REQUIRE_CONFIG(thread);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -97,6 +97,4 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,7 @@
|
||||
#include "QtCore/qqueue.h"
|
||||
#include "private/qobject_p.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
QT_REQUIRE_CONFIG(thread);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -184,5 +184,4 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "qthreadstorage.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qthread.h"
|
||||
#include "qthread_p.h"
|
||||
#include "qmutex.h"
|
||||
@ -323,6 +322,4 @@ void QThreadStorageData::finish(void **p)
|
||||
\sa localData(), hasLocalData()
|
||||
*/
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -152,7 +152,7 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#else // !QT_NO_THREAD
|
||||
#else // !QT_CONFIG(thread)
|
||||
|
||||
#include <qscopedpointer.h>
|
||||
|
||||
@ -227,6 +227,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
#endif // QTHREADSTORAGE_H
|
||||
|
@ -46,8 +46,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
class QDeadlineTimer;
|
||||
class QWaitConditionPrivate;
|
||||
@ -98,7 +97,7 @@ public:
|
||||
void wakeAll() {}
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -56,8 +56,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
@ -264,5 +262,3 @@ bool QWaitCondition::wait(QReadWriteLock *readWriteLock, QDeadlineTimer deadline
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -45,8 +45,6 @@
|
||||
#include "qlist.h"
|
||||
#include "qalgorithms.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
#define Q_MUTEX_T void*
|
||||
#include <private/qmutex_p.h>
|
||||
#include <private/qreadwritelock_p.h>
|
||||
@ -247,4 +245,3 @@ void QWaitCondition::wakeAll()
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -1,38 +1,66 @@
|
||||
# Qt core thread module
|
||||
|
||||
# public headers
|
||||
HEADERS += thread/qmutex.h \
|
||||
thread/qrunnable.h \
|
||||
thread/qreadwritelock.h \
|
||||
thread/qsemaphore.h \
|
||||
thread/qthread.h \
|
||||
thread/qthreadpool.h \
|
||||
thread/qthreadstorage.h \
|
||||
thread/qwaitcondition.h \
|
||||
thread/qatomic.h \
|
||||
thread/qatomic_bootstrap.h \
|
||||
thread/qatomic_cxx11.h \
|
||||
thread/qbasicatomic.h \
|
||||
thread/qgenericatomic.h
|
||||
HEADERS += \
|
||||
thread/qmutex.h \
|
||||
thread/qreadwritelock.h \
|
||||
thread/qrunnable.h \
|
||||
thread/qthread.h \
|
||||
thread/qthreadstorage.h \
|
||||
thread/qwaitcondition.h
|
||||
|
||||
# private headers
|
||||
HEADERS += thread/qmutex_p.h \
|
||||
thread/qmutexpool_p.h \
|
||||
thread/qfutex_p.h \
|
||||
thread/qorderedmutexlocker_p.h \
|
||||
thread/qreadwritelock_p.h \
|
||||
thread/qthread_p.h \
|
||||
thread/qthreadpool_p.h
|
||||
SOURCES += \
|
||||
thread/qrunnable.cpp \
|
||||
thread/qthread.cpp
|
||||
|
||||
SOURCES += thread/qatomic.cpp \
|
||||
thread/qmutex.cpp \
|
||||
thread/qreadwritelock.cpp \
|
||||
thread/qrunnable.cpp \
|
||||
thread/qmutexpool.cpp \
|
||||
thread/qsemaphore.cpp \
|
||||
thread/qthread.cpp \
|
||||
thread/qthreadpool.cpp \
|
||||
thread/qthreadstorage.cpp
|
||||
win32 {
|
||||
HEADERS += thread/qatomic_msvc.h
|
||||
|
||||
SOURCES += thread/qthread_win.cpp
|
||||
} else {
|
||||
SOURCES += thread/qthread_unix.cpp
|
||||
}
|
||||
|
||||
qtConfig(thread) {
|
||||
HEADERS += \
|
||||
thread/qatomic.h \
|
||||
thread/qatomic_bootstrap.h \
|
||||
thread/qatomic_cxx11.h \
|
||||
thread/qbasicatomic.h \
|
||||
thread/qfutex_p.h \
|
||||
thread/qgenericatomic.h \
|
||||
thread/qmutexpool_p.h \
|
||||
thread/qmutex_p.h \
|
||||
thread/qorderedmutexlocker_p.h \
|
||||
thread/qreadwritelock_p.h \
|
||||
thread/qsemaphore.h \
|
||||
thread/qthreadpool.h \
|
||||
thread/qthreadpool_p.h \
|
||||
thread/qthread_p.h
|
||||
|
||||
SOURCES += \
|
||||
thread/qatomic.cpp \
|
||||
thread/qmutex.cpp \
|
||||
thread/qmutexpool.cpp \
|
||||
thread/qreadwritelock.cpp \
|
||||
thread/qsemaphore.cpp \
|
||||
thread/qthreadpool.cpp \
|
||||
thread/qthreadstorage.cpp
|
||||
|
||||
win32 {
|
||||
SOURCES += \
|
||||
thread/qmutex_win.cpp \
|
||||
thread/qwaitcondition_win.cpp
|
||||
} else {
|
||||
darwin {
|
||||
SOURCES += thread/qmutex_mac.cpp
|
||||
} else: linux {
|
||||
SOURCES += thread/qmutex_linux.cpp
|
||||
} else {
|
||||
SOURCES += thread/qmutex_unix.cpp
|
||||
}
|
||||
SOURCES += thread/qwaitcondition_unix.cpp
|
||||
}
|
||||
}
|
||||
|
||||
qtConfig(future) {
|
||||
HEADERS += \
|
||||
@ -52,24 +80,4 @@ qtConfig(future) {
|
||||
thread/qresultstore.cpp
|
||||
}
|
||||
|
||||
win32 {
|
||||
HEADERS += thread/qatomic_msvc.h
|
||||
|
||||
SOURCES += \
|
||||
thread/qmutex_win.cpp \
|
||||
thread/qthread_win.cpp \
|
||||
thread/qwaitcondition_win.cpp
|
||||
} else {
|
||||
darwin {
|
||||
SOURCES += thread/qmutex_mac.cpp
|
||||
} else: linux {
|
||||
SOURCES += thread/qmutex_linux.cpp
|
||||
} else {
|
||||
SOURCES += thread/qmutex_unix.cpp
|
||||
}
|
||||
SOURCES += \
|
||||
thread/qthread_unix.cpp \
|
||||
thread/qwaitcondition_unix.cpp
|
||||
}
|
||||
|
||||
qtConfig(std-atomic64): QMAKE_USE += libatomic
|
||||
|
@ -2339,7 +2339,7 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT
|
||||
// localtime_r() does not have this requirement, so make an explicit call.
|
||||
// The explicit call should also request the timezone info be re-parsed.
|
||||
qt_tzset();
|
||||
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
|
||||
#if QT_CONFIG(thread) && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
|
||||
// Use the reentrant version of localtime() where available
|
||||
// as is thread-safe and doesn't use a shared static data area
|
||||
tm *res = 0;
|
||||
|
@ -79,10 +79,8 @@ bool qdbus_loadLibDBus()
|
||||
#endif
|
||||
|
||||
static bool triedToLoadLibrary = false;
|
||||
#ifndef QT_NO_THREAD
|
||||
static QBasicMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
#endif
|
||||
|
||||
QLibrary *&lib = qdbus_libdbus;
|
||||
if (triedToLoadLibrary)
|
||||
|
@ -979,7 +979,7 @@
|
||||
},
|
||||
"evdev": {
|
||||
"label": "evdev",
|
||||
"condition": "tests.evdev",
|
||||
"condition": "features.thread && tests.evdev",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"freetype": {
|
||||
@ -1170,7 +1170,7 @@
|
||||
},
|
||||
"egl_x11": {
|
||||
"label": "EGL on X11",
|
||||
"condition": "features.egl && tests.egl-x11",
|
||||
"condition": "features.thread && features.egl && tests.egl-x11",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"eglfs": {
|
||||
@ -1300,7 +1300,7 @@
|
||||
"section": "Platform plugins",
|
||||
"autoDetect": "!config.darwin",
|
||||
"enable": "input.xcb == 'system' || input.xcb == 'qt' || input.xcb == 'yes'",
|
||||
"condition": "libs.xcb",
|
||||
"condition": "features.thread && libs.xcb",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"system-xcb": {
|
||||
|
@ -2703,18 +2703,6 @@ static const int slow_timeout = 300000; // 5m
|
||||
|
||||
const uint QFontCache::min_cost = 4*1024; // 4mb
|
||||
|
||||
#ifdef QT_NO_THREAD
|
||||
Q_GLOBAL_STATIC(QFontCache, theFontCache)
|
||||
|
||||
QFontCache *QFontCache::instance()
|
||||
{
|
||||
return theFontCache();
|
||||
}
|
||||
|
||||
void QFontCache::cleanup()
|
||||
{
|
||||
}
|
||||
#else
|
||||
Q_GLOBAL_STATIC(QThreadStorage<QFontCache *>, theFontCache)
|
||||
|
||||
QFontCache *QFontCache::instance()
|
||||
@ -2736,7 +2724,6 @@ void QFontCache::cleanup()
|
||||
if (cache && cache->hasLocalData())
|
||||
cache->setLocalData(0);
|
||||
}
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(1);
|
||||
|
||||
|
@ -263,6 +263,7 @@
|
||||
"label": "HTTP",
|
||||
"purpose": "Provides support for the Hypertext Transfer Protocol in QNetworkAccessManager.",
|
||||
"section": "Networking",
|
||||
"condition": "features.thread",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"udpsocket": {
|
||||
@ -301,7 +302,7 @@
|
||||
"label": "Bearer management",
|
||||
"purpose": "Provides bearer management for the network stack.",
|
||||
"section": "Networking",
|
||||
"condition": "features.library && features.networkinterface && features.properties",
|
||||
"condition": "features.thread && features.library && features.networkinterface && features.properties",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"localserver": {
|
||||
|
@ -903,12 +903,10 @@ bool q_resolveOpenSslSymbols()
|
||||
{
|
||||
static bool symbolsResolved = false;
|
||||
static bool triedToResolveSymbols = false;
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(opensslv11)
|
||||
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_OPENSSL_init_ssl));
|
||||
#else
|
||||
QMutexLocker locker(QMutexPool::globalInstanceGet((void *)&q_SSL_library_init));
|
||||
#endif
|
||||
#endif
|
||||
if (symbolsResolved)
|
||||
return true;
|
||||
|
@ -43,14 +43,9 @@
|
||||
#include "private/qguiapplication_p.h"
|
||||
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
#include <QtCore/QAtomicInt>
|
||||
#include <QtCore/QSemaphore>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
@ -139,14 +139,6 @@ QtFreetypeData::~QtFreetypeData()
|
||||
library = 0;
|
||||
}
|
||||
|
||||
#ifdef QT_NO_THREAD
|
||||
Q_GLOBAL_STATIC(QtFreetypeData, theFreetypeData)
|
||||
|
||||
QtFreetypeData *qt_getFreetypeData()
|
||||
{
|
||||
return theFreetypeData();
|
||||
}
|
||||
#else
|
||||
Q_GLOBAL_STATIC(QThreadStorage<QtFreetypeData *>, theFreetypeData)
|
||||
|
||||
QtFreetypeData *qt_getFreetypeData()
|
||||
@ -169,7 +161,6 @@ QtFreetypeData *qt_getFreetypeData()
|
||||
}
|
||||
return freetypeData;
|
||||
}
|
||||
#endif
|
||||
|
||||
FT_Library qt_getFreetype()
|
||||
{
|
||||
|
@ -1231,7 +1231,6 @@ void QWindowsFontDatabase::populateFontDatabase()
|
||||
|
||||
typedef QSharedPointer<QWindowsFontEngineData> QWindowsFontEngineDataPtr;
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
typedef QThreadStorage<QWindowsFontEngineDataPtr> FontEngineThreadLocalData;
|
||||
|
||||
Q_GLOBAL_STATIC(FontEngineThreadLocalData, fontEngineThreadLocalData)
|
||||
@ -1243,17 +1242,6 @@ QSharedPointer<QWindowsFontEngineData> sharedFontData()
|
||||
data->setLocalData(QSharedPointer<QWindowsFontEngineData>::create());
|
||||
return data->localData();
|
||||
}
|
||||
#else // !QT_NO_THREAD
|
||||
Q_GLOBAL_STATIC(QWindowsFontEngineDataPtr, fontEngineData)
|
||||
|
||||
QWindowsFontEngineDataPtr sharedFontData()
|
||||
{
|
||||
QWindowsFontEngineDataPtr *data = fontEngineData();
|
||||
if (data->isNull())
|
||||
*data = QWindowsFontEngineDataPtr::create();
|
||||
return *data;
|
||||
}
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
QWindowsFontDatabase::QWindowsFontDatabase()
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ class QWindowsThreadPoolRunner
|
||||
{
|
||||
Q_DISABLE_COPY(QWindowsThreadPoolRunner)
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
template <class RunnableFunction> // nested class implementing QRunnable to execute a function.
|
||||
class Runnable : public QRunnable
|
||||
{
|
||||
@ -104,7 +104,7 @@ public:
|
||||
private:
|
||||
QMutex m_mutex;
|
||||
QWaitCondition m_condition;
|
||||
#else // !QT_NO_THREAD
|
||||
#else // QT_CONFIG(thread)
|
||||
public:
|
||||
QWindowsThreadPoolRunner() {}
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
f();
|
||||
return true;
|
||||
}
|
||||
#endif // QT_NO_THREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -1454,7 +1454,7 @@ bool QMYSQLDriver::open(const QString& db,
|
||||
d->preparedQuerysEnabled = false;
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
mysql_thread_init();
|
||||
#endif
|
||||
|
||||
@ -1468,7 +1468,7 @@ void QMYSQLDriver::close()
|
||||
{
|
||||
Q_D(QMYSQLDriver);
|
||||
if (isOpen()) {
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
mysql_thread_end();
|
||||
#endif
|
||||
mysql_close(d->mysql);
|
||||
|
@ -573,8 +573,11 @@ void QPrintPreviewDialogPrivate::_q_print()
|
||||
if (printer->outputFormat() != QPrinter::NativeFormat) {
|
||||
QString title = QCoreApplication::translate("QPrintPreviewDialog", "Export to PDF");
|
||||
QString suffix = QLatin1String(".pdf");
|
||||
QString fileName = QFileDialog::getSaveFileName(q, title, printer->outputFileName(),
|
||||
QString fileName;
|
||||
#if QT_CONFIG(filedialog)
|
||||
fileName = QFileDialog::getSaveFileName(q, title, printer->outputFileName(),
|
||||
QLatin1Char('*') + suffix);
|
||||
#endif
|
||||
if (!fileName.isEmpty()) {
|
||||
if (QFileInfo(fileName).suffix().isEmpty())
|
||||
fileName.append(suffix);
|
||||
|
@ -346,7 +346,9 @@ namespace QTest
|
||||
static int keyDelay = -1;
|
||||
static int mouseDelay = -1;
|
||||
static int eventDelay = -1;
|
||||
#if QT_CONFIG(thread)
|
||||
static int timeout = -1;
|
||||
#endif
|
||||
static bool noCrashHandler = false;
|
||||
|
||||
/*! \internal
|
||||
@ -397,7 +399,7 @@ int Q_TESTLIB_EXPORT defaultKeyDelay()
|
||||
}
|
||||
return keyDelay;
|
||||
}
|
||||
|
||||
#if QT_CONFIG(thread)
|
||||
static int defaultTimeout()
|
||||
{
|
||||
if (timeout == -1) {
|
||||
@ -409,6 +411,7 @@ static int defaultTimeout()
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
#endif
|
||||
|
||||
Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
|
||||
Q_TESTLIB_EXPORT QStringList testFunctions;
|
||||
@ -975,6 +978,8 @@ void TestMethods::invokeTestOnData(int index) const
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_CONFIG(thread)
|
||||
|
||||
class WatchDog : public QThread
|
||||
{
|
||||
public:
|
||||
@ -1026,6 +1031,17 @@ private:
|
||||
QWaitCondition waitCondition;
|
||||
};
|
||||
|
||||
#else // !QT_CONFIG(thread)
|
||||
|
||||
class WatchDog : public QObject
|
||||
{
|
||||
public:
|
||||
void beginTest() {};
|
||||
void testFinished() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
@ -81,7 +81,7 @@
|
||||
"label": "QFileSystemModel",
|
||||
"purpose": "Provides a data model for the local filesystem.",
|
||||
"section": "File I/O",
|
||||
"condition": "features.itemmodel",
|
||||
"condition": "features.itemmodel && features.thread",
|
||||
"output": [ "publicFeature", "feature" ]
|
||||
},
|
||||
"itemviews": {
|
||||
|
@ -1138,7 +1138,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
|
||||
|
||||
q->data = &data;
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
if (!parent) {
|
||||
Q_ASSERT_X(q->thread() == qApp->thread(), "QWidget",
|
||||
"Widgets must be created in the GUI thread.");
|
||||
|
@ -144,6 +144,7 @@
|
||||
#include "qcompleter_p.h"
|
||||
|
||||
#include "QtWidgets/qscrollbar.h"
|
||||
#include "QtCore/qdir.h"
|
||||
#include "QtCore/qstringlistmodel.h"
|
||||
#if QT_CONFIG(dirmodel)
|
||||
#include "QtWidgets/qdirmodel.h"
|
||||
|
@ -415,7 +415,7 @@ void tst_QCoreApplication::removePostedEvents()
|
||||
expected.clear();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
class DeliverInDefinedOrderThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -532,7 +532,7 @@ void tst_QCoreApplication::deliverInDefinedOrder()
|
||||
QObject::connect(&obj, SIGNAL(done()), &app, SLOT(quit()));
|
||||
app.exec();
|
||||
}
|
||||
#endif // QT_NO_QTHREAD
|
||||
#endif // QT_CONFIG(thread)
|
||||
|
||||
void tst_QCoreApplication::applicationPid()
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ private slots:
|
||||
void argc();
|
||||
void postEvent();
|
||||
void removePostedEvents();
|
||||
#ifndef QT_NO_THREAD
|
||||
#if QT_CONFIG(thread)
|
||||
void deliverInDefinedOrder();
|
||||
#endif
|
||||
void applicationPid();
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "qplatformdefs.h"
|
||||
#include "qthreadonce.h"
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
#include "qmutex.h"
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, onceInitializationMutex, (QMutex::Recursive))
|
||||
@ -104,5 +103,3 @@ void QOnceControl::done()
|
||||
{
|
||||
extra &= ~MustRunCode;
|
||||
}
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include <QtCore/qatomic.h>
|
||||
|
||||
|
||||
#ifndef QT_NO_THREAD
|
||||
|
||||
class QOnceControl
|
||||
{
|
||||
public:
|
||||
@ -91,6 +89,4 @@ public:
|
||||
inline operator T*() { return value(); }
|
||||
};
|
||||
|
||||
#endif // QT_NO_THREAD
|
||||
|
||||
#endif
|
||||
|
@ -1,22 +1,25 @@
|
||||
TEMPLATE=subdirs
|
||||
SUBDIRS=\
|
||||
qatomicint \
|
||||
qatomicinteger \
|
||||
qatomicpointer \
|
||||
qresultstore \
|
||||
qfuture \
|
||||
qfuturesynchronizer \
|
||||
qmutex \
|
||||
qmutexlocker \
|
||||
qreadlocker \
|
||||
qreadwritelock \
|
||||
qsemaphore \
|
||||
qthread \
|
||||
qthreadonce \
|
||||
qthreadpool \
|
||||
qthreadstorage \
|
||||
qwaitcondition \
|
||||
qwritelocker
|
||||
|
||||
qtHaveFeature(thread) {
|
||||
SUBDIRS=\
|
||||
qatomicint \
|
||||
qatomicinteger \
|
||||
qatomicpointer \
|
||||
qresultstore \
|
||||
qfuture \
|
||||
qfuturesynchronizer \
|
||||
qmutex \
|
||||
qmutexlocker \
|
||||
qreadlocker \
|
||||
qreadwritelock \
|
||||
qsemaphore \
|
||||
qthread \
|
||||
qthreadonce \
|
||||
qthreadpool \
|
||||
qthreadstorage \
|
||||
qwaitcondition \
|
||||
qwritelocker
|
||||
}
|
||||
|
||||
qtHaveModule(concurrent) {
|
||||
SUBDIRS += \
|
||||
|
Loading…
x
Reference in New Issue
Block a user