Thank you for responding, Thiago.

Actually, its not necessary to be root to use the pthreads priority API. Appropriate settings in /etc/security/limits.conf enable non-root users to alter thread priority.

I note that there are several calls to setPriority() found in the Qt libraries, such as Qt3D.

--
Art Greenberg
352-363-9002
a...@artg.tv

On 6/27/25 18:05, Thiago Macieira wrote:
On Friday, 27 June 2025 21:53:24 Central European Summer Time Art Greenberg
wrote:
I am able to overcome that limitation by obtaining the thread handle
returned by QThread::currentThreadId() and using the native pthreads
API. I am aware that this is not suggested in application code.

Actually, no, that's perfectly fine. You an also get the thread's TID and use
sched_setscheduler(2).

So, my question. Is there a way to set thread scheduling policy
provided, such that changing the priority will work? A pointer to the Qt
documentation would be appreciated.

If not, please consider this suggestion: add a method to QThread that
allows setting the scheduling policy, or allows setting the scheduling
policy and priority in a single call similar to pthread_setschedparam().

Sorry, the API in question is reserved for root. Since Qt applications are
almost always run as regular users, it would see very little use. Therefore, I
don't think we'll add it.

For the few users who need it and know what they're doing, like you, you can
use the pthreads or Linux-specific API. You're probably doing enough code
reviews and static analyses anyway for your application running as root that
this is not an undue burden.



--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to