From 0a06e1baf9e6da5308582b9dc928f4d9fea508d0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 29 Dec 2016 17:11:24 +0100 Subject: 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 --- src/corelib/kernel/qmetaobject.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/corelib/kernel/qmetaobject.cpp') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 65d0bd2351c..6c17535f079 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -50,7 +50,9 @@ #include #include #include +#if QT_CONFIG(thread) #include +#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; } -- cgit v1.2.3