runOnAndroidMainThread(): Use QThreadPool::start() instead of QtConcurrent::run()
The latter is in a module (QtConcurrent) that depends on QtCore. Don't make QtCore depend on QtConcurrent... The code doesn't use the QFuture returned from QtConcurrent::run(), anyway, so QThreadPool::start(function<void()>) is more than an adequate replacement. Task-number: QTBUG-109586 Change-Id: Id00a42525c3d7454a1fa2d4812de634dbbea1035 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 500e161987af24e2e10d46011d776258d5c0e47a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a3d8512fe1
commit
991b5dfe8c
@ -7,8 +7,10 @@
|
|||||||
#include <QtCore/private/qjnihelpers_p.h>
|
#include <QtCore/private/qjnihelpers_p.h>
|
||||||
#include <QtCore/qjniobject.h>
|
#include <QtCore/qjniobject.h>
|
||||||
#if QT_CONFIG(future) && !defined(QT_NO_QOBJECT)
|
#if QT_CONFIG(future) && !defined(QT_NO_QOBJECT)
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtCore/qfuture.h>
|
||||||
|
#include <QtCore/qfuturewatcher.h>
|
||||||
#include <QtCore/qpromise.h>
|
#include <QtCore/qpromise.h>
|
||||||
|
#include <QtCore/qthreadpool.h>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -160,7 +162,7 @@ QFuture<QVariant> QNativeInterface::QAndroidApplication::runOnAndroidMainThread(
|
|||||||
promise->start();
|
promise->start();
|
||||||
|
|
||||||
if (!timeout.isForever()) {
|
if (!timeout.isForever()) {
|
||||||
(void) QtConcurrent::run([=, &future]() {
|
QThreadPool::globalInstance()->start([=, &future]() {
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QTimer::singleShot(timeout.remainingTime(), &loop, [&]() {
|
QTimer::singleShot(timeout.remainingTime(), &loop, [&]() {
|
||||||
future.cancel();
|
future.cancel();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user