diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-15 17:15:41 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-16 09:04:29 +0000 |
commit | d7b361bc33992ed61310b709df476cc4fa9f67e5 (patch) | |
tree | a5aff750947862fd6e5cbc1eb6c677453caba1ae /src/qml/qml/ftw | |
parent | 3339bf866a68ba129e88fd7d27a2abbea0d1c6ba (diff) |
Reduce the overhead of type loader locking
Allow pulling the shared mutex out of the QQmlThread for the type loader
so that the lock and unlock calls can be inlined. We do a lot more of
those now.
Task-number: QTBUG-41465
Change-Id: I42f3d17feb08863f51b003b061d89f49c5a6d574
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/qml/qml/ftw')
-rw-r--r-- | src/qml/qml/ftw/qqmlthread.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/ftw/qqmlthread_p.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp index 78b477b472..96313d7627 100644 --- a/src/qml/qml/ftw/qqmlthread.cpp +++ b/src/qml/qml/ftw/qqmlthread.cpp @@ -57,6 +57,7 @@ public: void run() override; + inline QMutex &mutex() { return _mutex; } inline void lock() { _mutex.lock(); } inline void unlock() { _mutex.unlock(); } inline void wait() { _wait.wait(&_mutex); } @@ -263,6 +264,11 @@ bool QQmlThread::isShutdown() const return d->m_shutdown; } +QMutex &QQmlThread::mutex() +{ + return d->mutex(); +} + void QQmlThread::lock() { d->lock(); diff --git a/src/qml/qml/ftw/qqmlthread_p.h b/src/qml/qml/ftw/qqmlthread_p.h index 0ed12a2972..b5c580fe8b 100644 --- a/src/qml/qml/ftw/qqmlthread_p.h +++ b/src/qml/qml/ftw/qqmlthread_p.h @@ -59,6 +59,7 @@ QT_BEGIN_NAMESPACE class QThread; +class QMutex; class QQmlThreadPrivate; class QQmlThread @@ -71,6 +72,7 @@ public: void shutdown(); bool isShutdown() const; + QMutex &mutex(); void lock(); void unlock(); void wakeOne(); |