<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote type="cite">
  <div>Any idea what i am doing wrong?</div>
</blockquote>
<br>
yes<br>
<blockquote type="cite">
  <div>&nbsp;&nbsp;vrpnThread theThread;</div>
  <div>&nbsp;&nbsp;theThread.start();</div>
</blockquote>
You've allocated a stack object which creates the thread, the button
click routine exits immediately leaving the thread running, but the
object is destroyed. use "new theThread(blah); " and manage the pointer
by hand later<br>
<br>
JB<br>
<blockquote
 cite="mid:3755b5990903171512x455eb462icecc355d2582801a@mail.gmail.com"
 type="cite">Hi all,
  <div><br>
  </div>
  <div>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:</div>
  <div><br>
  </div>
  <div>In the run method of my class(which i inherit from QThread)</div>
  <div><br>
  </div>
  <div>void</div>
  <div>myThread::run()</div>
  <div>{</div>
  <div>&nbsp;&nbsp;analog = new vrpn_Analog_Remote(name.c_str());</div>
  <div>&nbsp;&nbsp;if(!analog)</div>
  <div>&nbsp;&nbsp;{</div>
  <div>&nbsp;&nbsp; &nbsp;cout &lt;&lt; "Error opening device";</div>
  <div>&nbsp;&nbsp; &nbsp;return;</div>
  <div>&nbsp;&nbsp; }</div>
  <div>&nbsp;else</div>
  <div>&nbsp;&nbsp;{</div>
  <div>&nbsp;&nbsp; &nbsp;std::cout&lt;&lt;"SUCCESS"&lt;&lt;std::endl;</div>
  <div>&nbsp;&nbsp; &nbsp;analog-&gt;register_change_handler ( NULL,
vrpnThread::handleAnalog );</div>
  <div>&nbsp;&nbsp; &nbsp;while(true)</div>
  <div>&nbsp;&nbsp; &nbsp;{</div>
  <div>&nbsp;&nbsp; &nbsp; &nbsp;analog-&gt;mainloop();</div>
  <div>&nbsp;&nbsp; &nbsp;}</div>
  <div>&nbsp;&nbsp;}</div>
  <div>}</div>
  <div><br>
  </div>
  <div>In the paraview GUI i have a button when pressed launches a
connection to a vrpn server, as follows:</div>
  <div><br>
  </div>
  <div>
  <div>void SourceToolbarActions::connectVRPNServer(void)</div>
  <div>{</div>
  <div>&nbsp;&nbsp;vrpnThread theThread;</div>
  <div>&nbsp;&nbsp;theThread.start();</div>
  <div>}</div>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div>So, when i click the GUI button a message appears saying the
following:</div>
  <div><br>
  </div>
  <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QThread: Destroyed while thread is still running...</div>
  <div><br>
  </div>
  <div>I have put the thread to wait also&nbsp;</div>
  <div><br>
  </div>
  <div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;theThread.wait()&nbsp;</div>
  <div><br>
  </div>
  <div>but if i do this its obviously that Paraview's GUI will get
blocked...</div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div>Any ideas how to work around this problem...</div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div>Thanks in advance.</div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div>Any idea what i am doing wrong?</div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div><br>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the ParaView Wiki at: <a class="moz-txt-link-freetext" href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="78">-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
<a class="moz-txt-link-freetext" href="http://www.cscs.ch/">http://www.cscs.ch/</a>
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82</pre>
</body>
</html>