summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-08-17 16:00:26 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2021-08-18 09:41:55 +0200
commit642b9fce81b46e23b35b17e8284bd81bdba57fdd (patch)
tree22c5f33e691bbbe6289acde7bbbc6b9f3191c09c /tests/auto/corelib/thread
parentc4ac9e74c79ebba3493ce29b25623b8c39b021a4 (diff)
QtConcurrent::run: support non default-constructible return types
The QtConcurrent::RunFunctionTask class keeps a variable to store the result of QtConcurrent::run when it becomes available, so that it can be reported afterwards. This requires the result type to be default-constructible. However there's no need in storing the result, it can be reported immediately after it becomes available. Pick-to: 6.1 6.2 Fixes: QTBUG-95214 Change-Id: I95f3dbff0ab41eaa81b104a8834b37d10a0d193a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread')
-rw-r--r--tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
index 929047c07e..33ecfb9cab 100644
--- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
+++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
@@ -229,12 +229,12 @@ void tst_QFutureWatcher::canceled()
future.waitForFinished();
}
-class IntTask : public RunFunctionTask<int>
+class IntTask : public RunFunctionTaskBase<int>
{
public:
void runFunctor() override
{
- result = 10;
+ promise.reportResult(10);
}
};
@@ -463,7 +463,7 @@ void tst_QFutureWatcher::disconnectRunningFuture()
}
const int maxProgress = 100000;
-class ProgressEmitterTask : public RunFunctionTask<void>
+class ProgressEmitterTask : public RunFunctionTaskBase<void>
{
public:
void runFunctor() override
@@ -493,7 +493,7 @@ void tst_QFutureWatcher::tooMuchProgress()
}
template <typename T>
-class ProgressTextTask : public RunFunctionTask<T>
+class ProgressTextTask : public RunFunctionTaskBase<T>
{
public:
void runFunctor() override