[Qt-interest] QThreads not running in parallel

Jothy jothybasu at gmail.com
Tue Oct 11 14:45:49 CEST 2011


Thanks for the reference

Here is the overrided run method of QThread subclass

void ThreadedScalarValueReader::runThread(vtkImageData* img,std::vector<int>
indX,std::vector<int>indY,std::vector<int>indZ,int start,int stop)

{

   for (int x=start;x<stop;x++)

    {

         this->result.push_back(img->GetScalarComponentAsFloat(indX[x],indY[x],indZ[x],0));

     }

 }




void ThreadedScalarValueReader::run()

{

      this->runThread(this->img,this->indX,this->indY,this->indZ,this->startValue,this->stopValue);

      //this->exec();

 }

If I uncomment this->exec() it shows all the thread in the task manager.
But it doesn't execute the code!

i tried
thread->start();
thread->wait();
thread->quit();

But the problem is not solved!

Jothy



On Tue, Oct 11, 2011 at 1:15 PM, sarvesh saran
<aquarian.thunder at gmail.com>wrote:

> On Tue, Oct 11, 2011 at 5:31 PM, Jothy <jothybasu at gmail.com> wrote:
>
>> I have 12 threads like this. But I see only 3/4 running simultaneously.
>>
>>
> The number of threads running simultaneously depends on your processor(s)
> and the OS. Post more code. You may find this useful :
> http://developer.qt.nokia.com/wiki/Threads_Events_QObjects
>
> -sarvesh
>



-- 
Jothybasu K Selvaraj
PhD Student
University of Liverpool
Liverpool,UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111011/ad743b0a/attachment.html 


More information about the Qt-interest-old mailing list