summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent/qtconcurrentiteratekernel
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-06-10 17:38:27 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2021-06-14 11:52:36 +0200
commit1bf75f2a661c05c7f1126187310d7df3f9704af5 (patch)
treeb218904f1b4da6e7ae59627af302a49c8c042d0e /tests/auto/concurrent/qtconcurrentiteratekernel
parent7dd4c937489451e72a671784dcd353e4c5bc16df (diff)
Remove the dead code for blocking methods from QtConcurrent
After 79fd1cb2c631b6084bf10874205d27f5b53c907a the methods for running QtConcurrent algorithms in the blocking mode aren't used anymore. Since ThreadEngineBase and ThreadEngineStarter classes aren't meant to be used externally, it should be fine to remove startBlocking() methods now. Removed the unused code and adjusted the tests accordingly. Change-Id: Ifb13820ce207869d6f720bcb5be8d35bb355fe33 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/concurrent/qtconcurrentiteratekernel')
-rw-r--r--tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
index 7fba6ed580..4163883a5b 100644
--- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
+++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
@@ -126,7 +126,8 @@ public:
void tst_QtConcurrentIterateKernel::instantiate()
{
- startThreadEngine(new PrintFor(0, 40)).startBlocking();
+ auto future = startThreadEngine(new PrintFor(0, 40)).startAsynchronously();
+ future.waitForFinished();
QCOMPARE(iterations.loadRelaxed(), 40);
}
@@ -165,8 +166,10 @@ void tst_QtConcurrentIterateKernel::stresstest()
const int times = 50;
for (int i = 0; i < times; ++i) {
counter.storeRelaxed(0);
- CountFor f(0, iterations);
- f.startBlocking();
+ // ThreadEngine will delete f when it finishes
+ auto f = new CountFor(0, iterations);
+ auto future = f->startAsynchronously();
+ future.waitForFinished();
QCOMPARE(counter.loadRelaxed(), iterations);
}
}
@@ -174,8 +177,12 @@ void tst_QtConcurrentIterateKernel::stresstest()
void tst_QtConcurrentIterateKernel::noIterations()
{
const int times = 20000;
- for (int i = 0; i < times; ++i)
- startThreadEngine(new IterateKernel<TestIterator, void>(QThreadPool::globalInstance(), 0, 0)).startBlocking();
+ for (int i = 0; i < times; ++i) {
+ auto future = startThreadEngine(new IterateKernel<TestIterator, void>(
+ QThreadPool::globalInstance(), 0, 0))
+ .startAsynchronously();
+ future.waitForFinished();
+ }
}
QMutex threadsMutex;
@@ -230,8 +237,10 @@ void tst_QtConcurrentIterateKernel::throttling()
threads.clear();
- ThrottleFor f(0, totalIterations);
- f.startBlocking();
+ // ThreadEngine will delete f when it finishes
+ auto f = new ThrottleFor(0, totalIterations);
+ auto future = f->startAsynchronously();
+ future.waitForFinished();
QCOMPARE(iterations.loadRelaxed(), totalIterations);