Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object");
QCoreApplication::self = this;
-
-#ifndef QT_NO_THREAD
- QThread::initialize();
-#endif
-
// use the event dispatcher created by the app programmer (if any)
if (!QCoreApplicationPrivate::eventDispatcher)
QCoreApplicationPrivate::eventDispatcher = d->threadData->eventDispatcher;
QCoreApplicationPrivate::is_app_closing = true;
QCoreApplicationPrivate::is_app_running = false;
-#if !defined(QT_NO_THREAD)
-#if !defined(QT_NO_CONCURRENT)
+#if !defined(QT_NO_THREAD) && !defined(QT_NO_CONCURRENT)
// Synchronize and stop the global thread pool threads.
QThreadPool *globalThreadPool = 0;
QT_TRY {
if (globalThreadPool)
globalThreadPool->waitForDone();
#endif
- QThread::cleanup();
-#endif
d_func()->threadData->eventDispatcher = 0;
if (QCoreApplicationPrivate::eventDispatcher)
QT_BEGIN_NAMESPACE
-// qt_global_mutexpool is here for backwards compatibility only,
-// use QMutexpool::instance() in new clode.
-Q_CORE_EXPORT QMutexPool *qt_global_mutexpool = 0;
Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive))
/*!
QMutex::RecursionMode recursionMode;
};
-extern Q_CORE_EXPORT QMutexPool *qt_global_mutexpool;
-
QT_END_NAMESPACE
#endif // QT_NO_THREAD
*/
QThreadData::QThreadData(int initialRefCount)
- : _ref(initialRefCount), thread(0), threadId(0),
- quitNow(false), loopLevel(0), eventDispatcher(0), canWait(true), isAdopted(false)
+ : _ref(initialRefCount), quitNow(false), canWait(true), isAdopted(false),
+ loopLevel(0), threadId(0), thread(0), eventDispatcher(0)
{
// fprintf(stderr, "QThreadData %p created\n", this);
}
(void) exec();
}
-/*! \internal
- Initializes the QThread system.
-*/
-#if defined (Q_OS_WIN)
-void qt_create_tls();
-#endif
-
-void QThread::initialize()
-{
- if (qt_global_mutexpool)
- return;
- qt_global_mutexpool = QMutexPool::instance();
-
-#if defined (Q_OS_WIN)
- qt_create_tls();
-#endif
-}
-
-
-/*! \internal
- Cleans up the QThread system.
-*/
-void QThread::cleanup()
-{
- qt_global_mutexpool = 0;
-}
-
/*!
\fn bool QThread::finished() const
Q_OBJECT
Q_DECLARE_PRIVATE(QThread)
- static void initialize();
- static void cleanup();
-
friend class QCoreApplication;
friend class QThreadData;
};
class QThreadData
{
- QAtomicInt _ref;
-
public:
QThreadData(int initialRefCount = 1);
~QThreadData();
}
};
- QThread *thread;
- Qt::HANDLE threadId;
+private:
+ QAtomicInt _ref;
+
+public:
bool quitNow;
- int loopLevel;
- QAbstractEventDispatcher *eventDispatcher;
- QStack<QEventLoop *> eventLoops;
- QPostEventList postEventList;
bool canWait;
- QVector<void *> tls;
bool isAdopted;
+ int loopLevel;
-
+ Qt::HANDLE threadId;
+ QStack<QEventLoop *> eventLoops;
+ QVector<void *> tls;
+ QThread *thread;
+ QAbstractEventDispatcher *eventDispatcher;
+ QPostEventList postEventList;
FlaggedDebugSignatures flaggedSignatures;
};