[Interest] Is this snippet correct- concurrent run

Christian Gagneraud chris at techworks.ie
Fri Oct 12 15:44:16 CEST 2012


Hi Sujan,

Copy/pasting code in email body can lead to strange formating depending 
on the reader's email client (Have a look below).
You better off using online copy/pasting tools like http://pastebin.com 
(free service). This way, anyone can read your code snippet, and with 
good syntax highlight too!

Chris

On 12/10/12 14:02, Sujan Dasmahapatra wrote:
> 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;
>
> intz=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(intth=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 
> <mailto:dasmahapatra.aerodynamics at yahoo.co.in>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


-- 
Christian Gagneraud,
Embedded systems engineer.
Techworks Marine
1 Harbour road
Dun Laoghaire
Co. Dublin
Ireland
Tel: + 353 (0) 1 236 5990
Web: http://www.techworks.ie/
--
Visit us at the International Conference on Ocean Energy
Dublin 17-19 Oct
http://www.icoe2012dublin.com/




More information about the Interest mailing list