Hi,there,
At present, I am using some vtk algorithms (the parent classes are vtkAlgorithm classes) to execute the Update function in the child threads. Sometimes, because it takes too long, I need to terminate the execution of the Update, so I called the SetAbortExecute (true) function in the main thread, but it did not end. Does anyone know what happened? The overall pseudo code logic is as follows:
void childThread(vtkSmartPointer<vtkAlgorithm> pAlgorithm)
{
// do algorithm
pAlgorithm ->Update();
}
void mainThread()
{
vtkSmartPointer<vtkAlgorithm>pAlgorithm=vtkSmartPointer<vtkAlgorithm>:: New();
// make some settings
......
std::thread(&childThread, pAlgorithm);
// stop after a period of time
......
pAlgorithm-> SetAbortExecute (true);
}