Sorry to intrude. I'm new to the list, and have joined because I have a
question/suggestion that it looks like only the dev team can respond to.
I haven't discovered a way to search the list archives to see if my
question has previously been answered.
I am a hobbyist. I write applications on and for Linux. Occasionally, I
need to elevate a thread's priority for a real-time (ish) application.
Using pthreads, its not difficult, but one does need to set the
scheduling policy to one that permits elevated priority. The policy I
find myself using the most is SCHED_FIFO.
I've recently started using QThread. It certainly makes launching a
thread simple. But calling QThread::setPriority() didn't seem to work
for me. I looked at the source for qthread_unix.cpp, and traced
QThread::start() and QThread::setPriority(). Attempting to elevate the
priority using using those methods fails because they use the -current-
thread scheduling policy. One would need to change the policy prior to
calling those methods. I do not see a (sanctioned) way to do that in
QThread.
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.
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().
Thanks for your time.
--
Art Greenberg
352-363-9002
a...@artg.tv
--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development