[vtkusers] multithreading java applications

Jonathan Morra jonmorra at gmail.com
Fri Nov 5 12:06:18 EDT 2010


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.

Thanks again for your help

PS, I have two outstanding questions that I really would like some help with
http://permalink.gmane.org/gmane.comp.lib.vtk.user/52639
<http://permalink.gmane.org/gmane.comp.lib.vtk.user/52639>and
http://comments.gmane.org/gmane.comp.lib.vtk.user/52679

On Wed, Nov 3, 2010 at 12:05 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> Hi Jonathan,
>
> VTK is not thread safe at all. So you first should be aware of that.
> Then any Swing call should be made in the EDT (event dispatch thread.
> SwingUtilities.invokeLater..)
> To get a more precise answer, you will need to be more precise in your
> multi-threaded case...
> Once the VTK objects are connected to the renderer, they should only
> be updated through the EDT.
>
> Seb
>
> On Wed, Nov 3, 2010 at 1:32 PM, Jonathan Morra <jonmorra at gmail.com> wrote:
> > I have an application that works fine in Java when the whole application
> is
> > in one thread.  However, when I multi-thread the application
> > I intermittently get the following error
> > ERROR: In ..\..\src\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 247
> > vtkWin32OpenGLRenderWindow (000000005AE922B0): wglMakeCurrent failed in
> > MakeCurrent(), error: The requested resource is in use.
> > I don't know what is going on, but it only happens when I use Java
> threads.
> > Does anyone know what's going on and how to fix it?
> > Thanks
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101105/46053017/attachment.htm>


More information about the vtkusers mailing list