How to terminate the execution of the vtk algorithm when using multiple threads?

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);
}

The filter has to regularly look at the AbortExecute flag and stop itself if requested. If the filter does not check the flag (or not doing it frequently enough) then it can be fixed by modifying the filter.

You can either wait for some funded project to need this fix; or you can fix yourself and send a merge request to VTK gitlab; or you can provide funding for someone else to implement it.