diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-07-31 14:09:11 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-08-05 18:05:04 +0200 |
commit | 559a72e4b637b9abb059e2708f206bbaca2be9e2 (patch) | |
tree | 0b1215fbd4a73bb8907ba5d5f7692c7def28d6b9 /src/concurrent/qtconcurrentrunbase.h | |
parent | c55aec2ed78a5c436a522ad571b10caaffa2295d (diff) |
QtConcurrent::run: allow to select the thread pool on which to run the task
This is the second and last part of the forward-port of
https://qt.gitorious.org/qt/qt/merge_requests/1281
[ChangeLog][QtConcurrent] run() now optionally takes as its first argument
the QThreadPool to run the task on.
Task-number: QTBUG-17220
Change-Id: I4b46eca6ef7de9cd34dac07e6d4b8ad830426b97
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/concurrent/qtconcurrentrunbase.h')
-rw-r--r-- | src/concurrent/qtconcurrentrunbase.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/concurrent/qtconcurrentrunbase.h b/src/concurrent/qtconcurrentrunbase.h index bd24c42ce2..ae638e5709 100644 --- a/src/concurrent/qtconcurrentrunbase.h +++ b/src/concurrent/qtconcurrentrunbase.h @@ -77,10 +77,16 @@ class RunFunctionTaskBase : public QFutureInterface<T> , public QRunnable public: QFuture<T> start() { + return start(QThreadPool::globalInstance()); + } + + QFuture<T> start(QThreadPool *pool) + { + this->setThreadPool(pool); this->setRunnable(this); this->reportStarted(); QFuture<T> theFuture = this->future(); - QThreadPool::globalInstance()->start(this, /*m_priority*/ 0); + pool->start(this, /*m_priority*/ 0); return theFuture; } |