summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread.cpp14
-rw-r--r--src/corelib/thread/qthread.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index f119828e8e..dc231a00f8 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -711,6 +711,20 @@ QThread::Priority QThread::priority() const
\sa terminate()
*/
+/*!
+ \since 5.5
+ Returns the current event loop level for the thread.
+
+ \note This can only be called within the thread itself, i.e. when
+ it is the current thread.
+*/
+
+int QThread::loopLevel() const
+{
+ Q_D(const QThread);
+ return d->data->eventLoops.size();
+}
+
#else // QT_NO_THREAD
QThread::QThread(QObject *parent)
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index 72d8f5a5f8..58755b9625 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -90,6 +90,7 @@ public:
void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
bool event(QEvent *event) Q_DECL_OVERRIDE;
+ int loopLevel() const;
public Q_SLOTS:
void start(Priority = InheritPriority);