summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthreadpool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
-rw-r--r--src/corelib/thread/qthreadpool.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index 6d258af9df0..911bf8a53a1 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -194,7 +194,7 @@ bool QThreadPoolPrivate::tryStart(QRunnable *task)
++activeThreads;
thread->runnable = task;
- thread->start();
+ thread->start(threadPriority);
return true;
}
@@ -265,7 +265,7 @@ void QThreadPoolPrivate::startThread(QRunnable *runnable)
++activeThreads;
thread->runnable = runnable;
- thread.take()->start();
+ thread.take()->start(threadPriority);
}
/*!
@@ -698,6 +698,32 @@ uint QThreadPool::stackSize() const
return d->stackSize;
}
+/*! \property QThreadPool::threadPriority
+ \brief the thread priority for new worker threads.
+
+ The value of the property is only used when the thread pool starts
+ new threads. Changing it has no effect for already running threads.
+
+ The default value is QThread::InheritPriority, which makes QThread
+ use the same priority as the one the QThreadPool object lives in.
+
+ \sa QThread::ThreadPriority
+
+ \since 6.2
+*/
+
+void QThreadPool::setThreadPriority(QThread::Priority priority)
+{
+ Q_D(QThreadPool);
+ d->threadPriority = priority;
+}
+
+QThread::Priority QThreadPool::threadPriority() const
+{
+ Q_D(const QThreadPool);
+ return d->threadPriority;
+}
+
/*!
Releases a thread previously reserved by a call to reserveThread().