[Paraview] Threads and paraview

Camilo Marin igetmyjunkmailhere at gmail.com
Tue Mar 17 18:12:14 EDT 2009


Hi all,
I have an issue concerning thread usage inside paraview. I am using the vrpn
library to connect some controllers and manipulate paraview's objects. I am
running the connection routine of vrpn on a separate thread (so the main
thread of paraview keeps running smooth). However i can't seem to launch the
thread correctly... what i am doing is:

In the run method of my class(which i inherit from QThread)

void
myThread::run()
{
  analog = new vrpn_Analog_Remote(name.c_str());
  if(!analog)
  {
    cout << "Error opening device";
    return;
   }
 else
  {
    std::cout<<"SUCCESS"<<std::endl;
    analog->register_change_handler ( NULL, vrpnThread::handleAnalog );
    while(true)
    {
      analog->mainloop();
    }
  }
}

In the paraview GUI i have a button when pressed launches a connection to a
vrpn server, as follows:

void SourceToolbarActions::connectVRPNServer(void)
{
  vrpnThread theThread;
  theThread.start();
}


So, when i click the GUI button a message appears saying the following:

            QThread: Destroyed while thread is still running...

I have put the thread to wait also

            theThread.wait()

but if i do this its obviously that Paraview's GUI will get blocked...


Any ideas how to work around this problem...


Thanks in advance.



Any idea what i am doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090317/ff1d5d70/attachment.htm>


More information about the ParaView mailing list