diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-06-02 10:48:06 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-06-04 22:32:43 +0200 |
commit | 37cfc3c6d2e3b290c7fc41cd7545283d24e4433c (patch) | |
tree | 91d3900ae5c113639467f3f47bd5217c42e29c2c /src/concurrent/qtconcurrentthreadengine.h | |
parent | 036c3c19e7da5f1a280750d3c68a0cff38678029 (diff) |
Deprecate the pause-related APIs of QFuture* classes
Deprecated the pause-related APIs of QFuture* classes and
added alternatives having "suspend" in the name instead.
With 2f15927f01ceef0aca490746302a5ea57ea9441c new
isSuspended()/suspended() APIs have been added to QFuture* classes for
checking if pause/suspension is still in progress or it already took
effect. To keep the naming more consistent, renamed:
- setPaused() -> setSuspended()
- pause() -> suspend()
- togglePaused() -> toggleSuspended()
- QFutureWatcher::paused() -> QFutureWatcher::suspending()
Note that QFuture*::isPaused() now corresponds to (isSuspending() ||
isSuspended()).
[ChangeLog][Deprecation Notice] Deprecated pause-related APIs of
QFuture and QFutureWatcher. Added alternatives having "suspend" in
the name instead.
Change-Id: Ibeb75017a118401d64d18b72fb95d78e28c4661c
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/concurrent/qtconcurrentthreadengine.h')
-rw-r--r-- | src/concurrent/qtconcurrentthreadengine.h | 11 |
1 files changed, 8 insertions, 3 deletions
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(); |