Making operators interruptible so that you can gracefully cancel the execution

I think it’s getting more and more important to be able to cancel long running operators as the mesh sizes increases.

The method suggested to me was to use timers and divide the task into smaller chunks. This makes an otherwise simple operator complicated. It also pauses the execution for a short while. I also think that this should be an expected behaviour of any operator so a simpler way of this could be beneficial for the implementations.

IMHO it would be nice to have a way to check if the escape key was pressed. It could be something as simple as a read only flag. That could easily be implemented in loops etc.
Another way would to make the Python API tread safe so you could run the operator in a separate thread and therefore allow the operator to have a supervisor. Maybe the API should provide a supervisor for all operators, at least for those executed by the user?

As you may have guessed, I’m not an expert on this. I just wanted to raise the question.