Cleanup QThread::initialize and QThread::cleanup
authorOlivier Goffart <ogoffart@woboq.com>
Fri, 2 Mar 2012 14:56:19 +0000 (15:56 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 6 Mar 2012 16:18:50 +0000 (17:18 +0100)
The qt_global_mutexpool was private API deprecated long time ago.

And there is no reason to call qt_create_tls because it is called in
QThreadData::current that is called from the QObject constructor, even
before QCoreApplication::init can be called.

Change-Id: Idf3576d8591377811b727b12edc43dc898570ba4
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
src/corelib/kernel/qcoreapplication.cpp
src/corelib/thread/qmutexpool.cpp
src/corelib/thread/qmutexpool_p.h
src/corelib/thread/qthread.cpp
src/corelib/thread/qthread.h

index 184743e..967ed44 100644 (file)
@@ -543,10 +543,6 @@ void QCoreApplication::init()
     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;
@@ -602,7 +598,6 @@ QCoreApplication::~QCoreApplication()
     }
     if (globalThreadPool)
         globalThreadPool->waitForDone();
-    QThread::cleanup();
 #endif
 
     d_func()->threadData->eventDispatcher = 0;
index b102770..6b6674c 100644 (file)
@@ -46,9 +46,6 @@
 
 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))
 
 /*!
index ce55a40..f5428be 100644 (file)
@@ -84,8 +84,6 @@ private:
     QMutex::RecursionMode recursionMode;
 };
 
-extern Q_CORE_EXPORT QMutexPool *qt_global_mutexpool;
-
 QT_END_NAMESPACE
 
 #endif // QT_NO_THREAD
index 64fd877..ea6760a 100644 (file)
@@ -42,7 +42,6 @@
 #include "qthread.h"
 #include "qthreadstorage.h"
 #include "qmutex.h"
-#include "qmutexpool_p.h"
 #include "qreadwritelock.h"
 #include "qabstracteventdispatcher.h"
 
@@ -537,33 +536,6 @@ void QThread::run()
     (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 void QThread::setPriority(Priority priority)
     \since 4.1
 
index ba119af..953632c 100644 (file)
@@ -128,9 +128,6 @@ private:
     Q_OBJECT
     Q_DECLARE_PRIVATE(QThread)
 
-    static void initialize();
-    static void cleanup();
-
     friend class QCoreApplication;
     friend class QThreadData;
 };