Problem with vtkThreadedController::Barrier()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with vtkThreadedController::Barrier()

Sebastien Valette
Hi all,
I have a problem with a multithreaded program. I thought that the method
vtkThreadedController::Barrier() was a method
to synchronize threads by stopping them until all the threads have
reached the point were Barrier() is called.

Unfortunately, the small code provided in this message hangs. Any idea?

Thank you,
Sebastien Valette

*********code begins**************
#include <vtkThreadedController.h>

// This will be called by all processes
void MyMain( vtkMultiProcessController *controller, void *arg )
{
  int myid, numProcs;
  myid = controller->GetLocalProcessId();
  numProcs = controller->GetNumberOfProcesses();
  cout<<numProcs<<" Processes"<<endl;
 controller->Barrier();
  cout<<"Barrier Passed !"<<endl;
}


int main( int argc, char* argv[] )
{
  vtkThreadedController *controller;
  controller = vtkThreadedController::New();
  controller->Initialize(0, 0);
  controller->SetSingleMethod(MyMain, 0);
  controller->SetNumberOfProcesses(8);
  controller->SingleMethodExecute();
  controller->Finalize();
  controller->Delete();
  return 0;
}

************ Code ends**********

--
http://www.creatis.insa-lyon.fr/~valette/

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers