From 1bf75f2a661c05c7f1126187310d7df3f9704af5 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Thu, 10 Jun 2021 17:38:27 +0200 Subject: Remove the dead code for blocking methods from QtConcurrent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Andrei Golubev --- .../tst_qtconcurrentiteratekernel.cpp | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'tests/auto/concurrent/qtconcurrentiteratekernel') 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(QThreadPool::globalInstance(), 0, 0)).startBlocking(); + for (int i = 0; i < times; ++i) { + auto future = startThreadEngine(new IterateKernel( + 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); -- cgit v1.2.3