diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcore_mac.cpp | 1 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 20 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 12 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qsystemerror.cpp | 4 |
5 files changed, 19 insertions, 24 deletions
diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp index b5df0db232..58380001a4 100644 --- a/src/corelib/kernel/qcore_mac.cpp +++ b/src/corelib/kernel/qcore_mac.cpp @@ -42,6 +42,7 @@ #include "qhash.h" #include "qpair.h" +#include "qmutex.h" #include "qvarlengtharray.h" QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index aea8fe6658..04da52a960 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -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 { diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 65d0bd2351..6c17535f07 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -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; } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 698ac256ff..6254330d25 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -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: " diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index fc825257ec..53c3136857 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -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 |