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;
  cout<<"Barrier Passed !"<<endl;

int main( int argc, char* argv[] )
  vtkThreadedController *controller;
  controller = vtkThreadedController::New();
  controller->Initialize(0, 0);
  controller->SetSingleMethod(MyMain, 0);
  return 0;

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


This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
Follow this link to subscribe/unsubscribe: