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? -
@CJha
Did you try QThread::setPriority(QThread::Priority priority) while the thread is running?Also, what platform are you on?
-
@CJha
You said so far it wasQThread::InherentPriority
, but transpires you meantInheritPriority
.Then I can only guess you must fetch/determine the caller's priority and use that to pass the relevant actual value to
setPriority()
.
3/5