How to interrupt async tasks?

@async returns a Task - you can interact with that, though note that interrupting running tasks from a different tasks is generally not a good idea. It’s usually better to write the tasks in a way that they check some condition from time to time to make sure they can shut down gracefully or have some waitable object that you can close.

EDIT: for some more context: