summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthreadpool.h
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@idiap.ch>2021-02-23 13:02:26 +0100
committerSamuel Gaist <samuel.gaist@idiap.ch>2021-04-03 09:14:55 +0200
commitbc00daae71df8a9691403b43e454aed4868ff9f3 (patch)
treee5f0244d46ae25c8a5466b0bfbfc16a858be2ffe /src/corelib/thread/qthreadpool.h
parentc2a09242c82b07064ddd99557e7eaf98556d5170 (diff)
Add support to set thread priority to QThreadPool
Currently, QThreadPool's generated threads inherit the priority from the thread they are created and that cannot be changed. This merge request adds a property to QThreadPool so that the priority of the threads can be different. The default behavior does not change. [ChangeLog][QtCore][QThreadPool] QThreadPool can now be configured to use a different thread priority when creating new threads than the one it inherits from the thread it was created in. This will only apply to the threads started after the property is changed. Fixes: QTBUG-3481 Change-Id: Ic98d4312d055a3357771abb656516ebd0715918d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qthreadpool.h')
-rw-r--r--src/corelib/thread/qthreadpool.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h
index a559eff49a..f3d7e2254b 100644
--- a/src/corelib/thread/qthreadpool.h
+++ b/src/corelib/thread/qthreadpool.h
@@ -60,6 +60,7 @@ class Q_CORE_EXPORT QThreadPool : public QObject
Q_PROPERTY(int maxThreadCount READ maxThreadCount WRITE setMaxThreadCount)
Q_PROPERTY(int activeThreadCount READ activeThreadCount)
Q_PROPERTY(uint stackSize READ stackSize WRITE setStackSize)
+ Q_PROPERTY(QThread::Priority threadPriority READ threadPriority WRITE setThreadPriority)
friend class QFutureInterfaceBase;
public:
@@ -85,6 +86,9 @@ public:
void setStackSize(uint stackSize);
uint stackSize() const;
+ void setThreadPriority(QThread::Priority priority);
+ QThread::Priority threadPriority() const;
+
void reserveThread();
void releaseThread();