diff options
Diffstat (limited to 'src/concurrent')
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.cpp | 10 | ||||
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.h | 11 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp index 7ea606f60b..2c6e052621 100644 --- a/src/concurrent/qtconcurrentthreadengine.cpp +++ b/src/concurrent/qtconcurrentthreadengine.cpp @@ -219,9 +219,9 @@ void ThreadEngineBase::acquireBarrierSemaphore() barrier.acquire(); } -void ThreadEngineBase::reportIfPausedDone() const +void ThreadEngineBase::reportIfSuspensionDone() const { - if (futureInterface && futureInterface->isPaused()) + if (futureInterface && futureInterface->isSuspending()) futureInterface->reportSuspended(); } @@ -313,11 +313,11 @@ void ThreadEngineBase::run() // implements QRunnable. 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 + // If the last worker thread is throttled and the state is "suspending", + // it means that suspension has been requested, and it is already // in effect (because all previous threads have already exited). // Report the "Suspended" state. - reportIfPausedDone(); + reportIfSuspensionDone(); } } diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h index 4e7e8d0b81..82bff5fb3a 100644 --- a/src/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -99,14 +99,19 @@ public: void setProgressValue(int progress); void setProgressRange(int minimum, int maximum); void acquireBarrierSemaphore(); - void reportIfPausedDone() const; + void reportIfSuspensionDone() const; protected: // The user overrides these: virtual void start() {} virtual void finish() {} virtual ThreadFunctionResult threadFunction() { return ThreadFinished; } - virtual bool shouldStartThread() { return futureInterface ? !futureInterface->isPaused() : true; } - virtual bool shouldThrottleThread() { return futureInterface ? futureInterface->isPaused() : false; } + virtual bool shouldStartThread() { return !shouldThrottleThread(); } + virtual bool shouldThrottleThread() + { + return futureInterface ? (futureInterface->isSuspending() || futureInterface->isSuspended()) + : false; + } + private: bool startThreadInternal(); void startThreads(); |