diff options
Diffstat (limited to 'src/concurrent')
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.cpp | 15 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.h | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index 7dfc29c68f..7ea606f60b 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -219,6 +219,12 @@ void ThreadEngineBase::acquireBarrierSemaphore() barrier.acquire(); } +void ThreadEngineBase::reportIfPausedDone() const +{ + if (futureInterface && futureInterface->isPaused()) + futureInterface->reportSuspended(); +} + bool ThreadEngineBase::isCanceled() { if (futureInterface) @@ -304,8 +310,15 @@ void ThreadEngineBase::run() // implements QRunnable. // struct wants to be throttled by making a worker thread exit. // Respect that request unless this is the only worker thread left // running, in which case it has to keep going. - if (threadThrottleExit()) + if (threadThrottleExit()) { return; + } else { + // If the last worker thread is throttled and the state is paused, + // it means that pause has been requested, and it is already + // in effect (because all previous threads have already exited). + // Report the "Suspended" state. + reportIfPausedDone(); + } } #ifndef QT_NO_EXCEPTIONS diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h index eb11c34c06..4e7e8d0b81 100644 --- a/src/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -99,6 +99,7 @@ public: void setProgressValue(int progress); void setProgressRange(int minimum, int maximum); void acquireBarrierSemaphore(); + void reportIfPausedDone() const; protected: // The user overrides these: virtual void start() {} |