[Interest] QtConcurrent programming need help

Sujan Dasmahapatra sujan.dasmahapatra at gmail.com
Thu Sep 27 20:32:36 CEST 2012


I am working on an existing application where  threads are submitted
concurrently. he is submitting 8 threads together and then he is waiting
for all 8 threads to be finished to submit the next 8 threads. In this way
after every 8 threads he is waiting and a lot of time is being taken for
waiting. Can you me some suggestions how can I skip this waiting after
submitting 8 threads to improve speed. Total number of cpu is 8 so he is
submitting 8 threads at  a time.

Submitting threads like this

int nCpus = Environment::Get_No_Of_Cpus(); // ==8
for(z=0; z<21; z++)
{
for (int cpuID=0; cpuID<nCpus; cpuID++)
{
Th = QtConcurrent::run(this, zLayerFunction,z,...,cpuID);
Threads.push_back(Th);
}
//then he after submitting 8 threads, he is waiting for all 8 threads to be
finished to submit the next 8 threads.

for(int th=0; th<Threads.size(); th++ )
{
     Threads.at(th).waitForFinished();
     Threads.cancel();
}

Threads.clear();
z--;
}

How can i improve the speed so that it doesn't wait. How can I make it
continuous. Any suggestions would be highly appreciated. Thanks Sujan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120927/657c15c4/attachment.html>


More information about the Interest mailing list