[vtkusers] Are VTK Objects Thread-Safe ?

chasank chasank at gmail.com
Thu May 19 07:56:14 EDT 2011


Short Question : Are VTK Objects Thread-Safe ?
Long one: Let assume I have two threads in a process, ThreadA and ThreadB
and have a piece of code as below; vtkObject is created on global scope that
threads can access, but instantiated in ThreadA, I'm sure that ThreadA is
starts to work before ThreadB, and what happens if ThreadB tries to access
vtkObject which is instantiated on ThreadA?
I've that kind of structure and when I run the process, vtkOutputWindows
prints that message;
ERROR: In ..\..\Source\VTK\Rendering\vtkWin32OpenGLRenderWindow.cxx, line
247
vtkWin32OpenGLRenderWindow (01AAAFC8): wglMakeCurrent failed in
MakeCurrent(), error: İstenen kaynak kullanımda. (resource is used)


vtkSmartPointer < vtkClass > vtkObject;

void ThreadA {
  locked = true;
  vtkObject = vtkSmartPointer < vtkClass > :: New();
  vtkObject->SetSomething(params...);
  locked = false;
}

void ThreadB {
  while(true)
  {
     if ( !locked )
     {
          vtkObject->SetorGetSomething(params... );
          break;
      }
   }

--
View this message in context: http://vtk.1045678.n5.nabble.com/Are-VTK-Objects-Thread-Safe-tp4409486p4409486.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list