That makes a lot of sense about why this is so frustrating. Thanks to your advice, I am able to make use of invokeLater to at least display dialogs to the user and then run processes on the event dispatch thread. In addition I'm trying to work with SwingWorker's doInBackground and done methods to move VTK operations that are not yet attached to the UI into a different thread, and then attach them to the UI in the done() method. <div>
<br></div><div>Thanks again for your help</div><div><br></div><div>PS, I have two outstanding questions that I really would like some help with</div><div><a href="http://permalink.gmane.org/gmane.comp.lib.vtk.user/52639">http://permalink.gmane.org/gmane.comp.lib.vtk.user/52639</a></div>
<div><a href="http://permalink.gmane.org/gmane.comp.lib.vtk.user/52639"></a>and</div><div><a href="http://comments.gmane.org/gmane.comp.lib.vtk.user/52679">http://comments.gmane.org/gmane.comp.lib.vtk.user/52679</a><br><br>
<div class="gmail_quote">On Wed, Nov 3, 2010 at 12:05 PM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jonathan,<br>
<br>
VTK is not thread safe at all. So you first should be aware of that.<br>
Then any Swing call should be made in the EDT (event dispatch thread.<br>
SwingUtilities.invokeLater..)<br>
To get a more precise answer, you will need to be more precise in your<br>
multi-threaded case...<br>
Once the VTK objects are connected to the renderer, they should only<br>
be updated through the EDT.<br>
<br>
Seb<br>
<div><div></div><div class="h5"><br>
On Wed, Nov 3, 2010 at 1:32 PM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
> I have an application that works fine in Java when the whole application is<br>
> in one thread. However, when I multi-thread the application<br>
> I intermittently get the following error<br>
> ERROR: In ..\..\src\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 247<br>
> vtkWin32OpenGLRenderWindow (000000005AE922B0): wglMakeCurrent failed in<br>
> MakeCurrent(), error: The requested resource is in use.<br>
> I don't know what is going on, but it only happens when I use Java threads.<br>
> Does anyone know what's going on and how to fix it?<br>
> Thanks<br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</blockquote></div><br></div>