diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2012-02-29 00:57:12 +0100 |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2012-02-29 00:58:13 +0100 |
commit | c4ad58ed2252d5ed9f448a5c068ab33dce4cadd9 (patch) | |
tree | 7e9802171d7b4c641c2de1ef781023cab5d7d14c /src/corelib/thread/qthread_p.h | |
parent | 7da3a61b5fd5cc726f8fd62691aa5f84c7929800 (diff) | |
parent | fa1b9070af66edb81b2a3735c1951f78b22bd666 (diff) |
Merge remote-tracking branch 'gerrit/master' into containers
Change-Id: I97ba222435ff50a9e5422e6f2c73e4bb8d1b865c
Diffstat (limited to 'src/corelib/thread/qthread_p.h')
-rw-r--r-- | src/corelib/thread/qthread_p.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index d8374e9805..6597b56893 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -60,6 +60,7 @@ #include "QtCore/qstack.h" #include "QtCore/qwaitcondition.h" #include "QtCore/qmap.h" +#include "QtCore/qcoreapplication.h" #include "private/qobject_p.h" @@ -144,6 +145,7 @@ public: ~QThreadPrivate(); mutable QMutex mutex; + QAtomicInt quitLockRef; bool running; bool finished; @@ -179,6 +181,18 @@ public: QThreadData *data; static void createEventDispatcher(QThreadData *data); + + void ref() + { + quitLockRef.ref(); + } + + void deref() + { + if (!quitLockRef.deref() && running) { + QCoreApplication::instance()->postEvent(q_ptr, new QEvent(QEvent::Quit)); + } + } }; #else // QT_NO_THREAD @@ -195,6 +209,9 @@ public: static QThread *threadForId(int) { return QThread::currentThread(); } static void createEventDispatcher(QThreadData *data); + void ref() {} + void deref() {} + Q_DECLARE_PUBLIC(QThread) }; |