How do I set the QThread priority to InherentPriority when it's running?
-
Hi, I know I can start a
QThread myThread
withQThread::InherentPriority
by usingmyThread->start()
. When the thread is running the functionQThread::setPriority(QThread::Priority)
can be used to change it's priority, but the documentation saysThe priority argument can be any value in the QThread::Priority enum except for InheritPriority.
So, if I start my thread such as
myThread->start(QThread::HighPriority)
then how can I want to switch back toQThread::InherentPriority
? Will I have to quit and restart again, is that the only option? -
Hi, I know I can start a
QThread myThread
withQThread::InherentPriority
by usingmyThread->start()
. When the thread is running the functionQThread::setPriority(QThread::Priority)
can be used to change it's priority, but the documentation saysThe priority argument can be any value in the QThread::Priority enum except for InheritPriority.
So, if I start my thread such as
myThread->start(QThread::HighPriority)
then how can I want to switch back toQThread::InherentPriority
? Will I have to quit and restart again, is that the only option? -
@JonB I tried it, it says
QThread::setPriority: Argument cannot be InheritPriority
For any other priority, it works fine (at least no error or warning).
I am using Windows 11.