diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-11-29 10:59:48 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-02 15:59:58 +0100 |
commit | ad8edac53c65368f7ff269332bd66bd85e2633b4 (patch) | |
tree | 7999854d2784adea00319acaad69a0a38a1baa2f /src/corelib/thread | |
parent | 613183ff8c101fe544814259197d897b3540bc85 (diff) |
Remove QInternal callbacks and internal functions
After commit 79f675a1e0f628bbc25345ebc1eb1f5809166c6b, the connect and
disconnect callback API effectively becomes useless. Now that these
callbacks cannot/do not, it makes little sense to keep the backdoors
added for Qt Jambi support.
Remove them for now. Should the Qt Jambi team want/need to port to Qt 5,
we can re-add them, possibly designing a better API for doing so as
well.
Change-Id: I6209a1d647d683c979d5294b632b8c12c0f9f91c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qthread.cpp | 7 | ||||
-rw-r--r-- | src/corelib/thread/qthread_p.h | 1 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 27 | ||||
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 32 |
4 files changed, 19 insertions, 48 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 17b0f2cb94..1df768c1ed 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -152,13 +152,6 @@ QAdoptedThread::~QAdoptedThread() // fprintf(stderr, "~QAdoptedThread = %p\n", this); } -QThread *QAdoptedThread::createThreadForAdoption() -{ - QScopedPointer<QThread> t(new QAdoptedThread(0)); - t->moveToThread(t.data()); - return t.take(); -} - void QAdoptedThread::run() { // this function should never be called diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 66dd8db7c7..bbaf664a2d 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -248,7 +248,6 @@ public: ~QAdoptedThread(); void init(); - static QThread *createThreadForAdoption(); private: void run(); }; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 8c6fefcfd7..6deae261c6 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -199,28 +199,17 @@ QThreadData *QThreadData::current() { QThreadData *data = get_thread_data(); if (!data) { - void *a; - if (QInternal::activateCallbacks(QInternal::AdoptCurrentThread, &a)) { - QThread *adopted = static_cast<QThread*>(a); - Q_ASSERT(adopted); - data = QThreadData::get2(adopted); + data = new QThreadData; + QT_TRY { set_thread_data(data); - adopted->d_func()->running = true; - adopted->d_func()->finished = false; - static_cast<QAdoptedThread *>(adopted)->init(); - } else { - data = new QThreadData; - QT_TRY { - set_thread_data(data); - data->thread = new QAdoptedThread(data); - } QT_CATCH(...) { - clear_thread_data(); - data->deref(); - data = 0; - QT_RETHROW; - } + data->thread = new QAdoptedThread(data); + } QT_CATCH(...) { + clear_thread_data(); data->deref(); + data = 0; + QT_RETHROW; } + data->deref(); data->isAdopted = true; data->threadId = (Qt::HANDLE)pthread_self(); if (!QCoreApplicationPrivate::theMainThread) diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 5b74bad7ef..0c834cfff2 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -101,29 +101,19 @@ QThreadData *QThreadData::current() qt_create_tls(); QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index)); if (!threadData) { - QThread *adopted = 0; - if (QInternal::activateCallbacks(QInternal::AdoptCurrentThread, (void **) &adopted)) { - Q_ASSERT(adopted); - threadData = QThreadData::get2(adopted); - TlsSetValue(qt_current_thread_data_tls_index, threadData); - adopted->d_func()->running = true; - adopted->d_func()->finished = false; - static_cast<QAdoptedThread *>(adopted)->init(); - } else { - threadData = new QThreadData; - // This needs to be called prior to new AdoptedThread() to - // avoid recursion. - TlsSetValue(qt_current_thread_data_tls_index, threadData); - QT_TRY { - threadData->thread = new QAdoptedThread(threadData); - } QT_CATCH(...) { - TlsSetValue(qt_current_thread_data_tls_index, 0); - threadData->deref(); - threadData = 0; - QT_RETHROW; - } + threadData = new QThreadData; + // This needs to be called prior to new AdoptedThread() to + // avoid recursion. + TlsSetValue(qt_current_thread_data_tls_index, threadData); + QT_TRY { + threadData->thread = new QAdoptedThread(threadData); + } QT_CATCH(...) { + TlsSetValue(qt_current_thread_data_tls_index, 0); threadData->deref(); + threadData = 0; + QT_RETHROW; } + threadData->deref(); threadData->isAdopted = true; threadData->threadId = (Qt::HANDLE)GetCurrentThreadId(); |