diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-06-10 17:38:27 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-06-14 11:52:36 +0200 |
commit | 1bf75f2a661c05c7f1126187310d7df3f9704af5 (patch) | |
tree | b218904f1b4da6e7ae59627af302a49c8c042d0e /src/concurrent | |
parent | 7dd4c937489451e72a671784dcd353e4c5bc16df (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 'src/concurrent')
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.cpp | 33 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.h | 23 |
2 files changed, 0 insertions, 56 deletions
diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index fcc504a96c..399afb6195 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -176,39 +176,6 @@ void ThreadEngineBase::startSingleThreaded() finish(); } -void ThreadEngineBase::startBlocking() -{ - start(); - barrier.acquire(); - startThreads(); - - bool throttled = false; -#ifndef QT_NO_EXCEPTIONS - try { -#endif - while (threadFunction() == ThrottleThread) { - if (threadThrottleExit()) { - throttled = true; - break; - } - } -#ifndef QT_NO_EXCEPTIONS - } catch (QException &e) { - handleException(e); - } catch (...) { - handleException(QUnhandledException(std::current_exception())); - } -#endif - - if (throttled == false) { - barrier.release(); - } - - barrier.wait(); - finish(); - exceptionStore.throwPossibleException(); -} - void ThreadEngineBase::startThread() { startThreadInternal(); diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h index 4cd5b85210..5a78377e71 100644 --- a/src/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -91,7 +91,6 @@ public: ThreadEngineBase(QThreadPool *pool); virtual ~ThreadEngineBase(); void startSingleThreaded(); - void startBlocking(); void startThread(); bool isCanceled(); void waitForResume(); @@ -154,15 +153,6 @@ public: } // Runs the user algorithm using multiple threads. - // This function blocks until the algorithm is finished, - // and then returns the result. - T *startBlocking() - { - ThreadEngineBase::startBlocking(); - return result(); - } - - // Runs the user algorithm using multiple threads. // Does not block, returns a future. QFuture<T> startAsynchronously() { @@ -242,13 +232,6 @@ class ThreadEngineStarter : public ThreadEngineStarterBase<T> public: ThreadEngineStarter(TypedThreadEngine *eng) : Base(eng) { } - - T startBlocking() - { - T t = *this->threadEngine->startBlocking(); - delete this->threadEngine; - return t; - } }; // Full template specialization where T is void. @@ -258,12 +241,6 @@ class ThreadEngineStarter<void> : public ThreadEngineStarterBase<void> public: ThreadEngineStarter(ThreadEngine<void> *_threadEngine) : ThreadEngineStarterBase<void>(_threadEngine) {} - - void startBlocking() - { - this->threadEngine->startBlocking(); - delete this->threadEngine; - } }; //! [qtconcurrentthreadengine-1] |