diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-16 12:58:46 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-16 17:27:15 +0000 |
commit | 61edfb7f31e70d55e3e272f968f9f5258a363679 (patch) | |
tree | 1c5f204f54970b4220f1ccf7fd36be7acd7153a9 /src/qml/qml/ftw | |
parent | fe7249afb813b7c8bb14ba80755ef7203c499214 (diff) |
QQmlThread: get rid of startup synchronization
startup() waits for a notification from the worker thread, which does
this as its first action in run(). However, there is no data set up by
the worker thread that would require this kind of synchronization.
As the whole procedure is superfluous, simplify startup to only start
the QThread, and move it to itself (an anti-pattern to be revisited
later).
We also can get rid of the run() override, as the default implementation
does everything we need - namely starting the event loop.
Change-Id: I648778913893ebce9efc6aa61e38ed38cad0b0e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/ftw')
-rw-r--r-- | src/qml/qml/ftw/qqmlthread.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp index 6a471bcd00..b33bbffc57 100644 --- a/src/qml/qml/ftw/qqmlthread.cpp +++ b/src/qml/qml/ftw/qqmlthread.cpp @@ -21,8 +21,6 @@ public: QQmlThreadPrivate(QQmlThread *); QQmlThread *q; - void run() override; - inline QMutex &mutex() { return _mutex; } inline void lock() { _mutex.lock(); } inline void unlock() { _mutex.unlock(); } @@ -108,17 +106,6 @@ bool QQmlThreadPrivate::event(QEvent *e) return QThread::event(e); } -void QQmlThreadPrivate::run() -{ - lock(); - - wakeOne(); - - unlock(); - - exec(); -} - void QQmlThreadPrivate::mainEvent() { lock(); @@ -197,10 +184,7 @@ QQmlThread::~QQmlThread() */ void QQmlThread::startup() { - d->lock(); d->start(); - d->wait(); - d->unlock(); d->moveToThread(d); } |