PDA

View Full Version : How to set thread priority for QtConcurrent::map



lni
21st October 2011, 15:17
Hi,

My machine is a single core with QThread::idealThreadCount() = 1

I made 2 QtConcurrent::map calls. The problem is that the 2nd one doesn't start until the 1st one finished. What can I do to start the 2nd one immediately and let all others yield for it?

thanks!

hugh_lou
21st October 2011, 21:24
Maybe your 1st thread can finish the job within a time slice. Therefore, the 2nd one always starts after the 1st one is finished.
Actually, on a single core computer, I do not think there is any way to run two threads concurrently.
The OS always assigns time slices to threads one by one.

wysota
21st October 2011, 21:32
QtConcurrent doesn't support prioritizing tasks. Once a task is running and the pool of threads is depleted, all other tasks will pend until there is a thread available.