PDA

View Full Version : Control the priority of QtConcurrent::run()?



PolyVox
13th February 2010, 17:09
Hi all,

When using the QtConcurrent::run() function I don't see any way to control the priority of the thread on which the code executes. For other threading functions such as QThreadPool::start() and the QThread class it is possible to control this. Is there a reason why QtConcurrent omits this functionality? Any way to work around it?

Thanks!

PolyVox
13th February 2010, 18:42
On further investigation I realise that priority is used in two different ways. QThread::setPriority() sets the amount of time the operating system will devote to that thread, whereas the priority passed to QThreadPool::start() simply controls the order in which the QRunnables are processed by the QThreadPool.

So, further to my previous question, is it possible to set the operating system priority of the threads in a QThreadPool, or to have greater control over which Runnables are executed on which priority threads? I have some tasks which are background tasks and some where I want the results soon.

Any ideas?

toutarrive
15th February 2010, 21:24
When working with thread , one must keep in mind that you can never assume anything.

I would stuck to the Qt documentation and nothing else.

ecanela
16th February 2010, 01:10
i have the same problems, some weeks ago, and i can´t find the way to control the priority use QConcurrent framework.

i have to use QThread directly, but i can use a QRunnable and QThreadPool approach.

check the introduction to thread to more details http://www.ics.com/learning/icsnetwork/

ecanela
16th February 2010, 01:14
i have the same problems, some weeks ago, and i can´t find the way to control the priority use QConcurrent framework.

i have to use QThread directly, but i can use a QRunnable and QThreadPool approach.

check the introduction to thread to more details http://www.ics.com/learning/icsnetwork/