def METHOD_NAME(self):
    """
    clean cache if thread is running. Call :py:meth:`SegmentationAlgorithm.clean` otherwise. :
    """
    self.mutex.lock()
    if self.isRunning():
        self.clean_later = True
    else:
        self.algorithm.METHOD_NAME()
    self.mutex.unlock()