[Interest] Is this snippet correct- concurrent run

Sujan Dasmahapatra sujan.dasmahapatra at gmail.com
Fri Oct 12 15:02:23 CEST 2012


Is this code snippet correct?  I am  trying to submit a number of threads
if global actibe threadcount is less than global max thread count.

[code]

QFuture<

void> Th;

std::vector<QFuture<

void> > Threads;

int z=0;

while(z<nZ) {

while(QThreadPool::globalInstance()->activeThreadCount() <
QThreadPool::globalInstance()->maxThreadCount()) {

Th = QtConcurrent::run(

this,&UNRSTParser::ProcessZLayer,z);

Threads.push_back(Th);

z++;

values += (nX*nY);

if(z==nZ)

break;

}

}

//cout << " ZFinished...\n";

for(int th=0; th<Threads.size(); th++)

Threads[th].waitForFinished();

Threads.clear();
[/code]

-- 
Regards
Sujan Dasmahapatra
skype: sujan.dasmahapatra
yahoo msn : dasmahapatra.aerodynamics at yahoo.co.in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121012/6233982d/attachment.html>


More information about the Interest mailing list