Stop/terminate a (sub)task started with @async

Yes, that might work sometimes, but you’re messing with the internal state of the scheduler, so it’s not really safe. But you’re just controlling the wrong object: sleep is just a thin wrapper around Timer and the Timer object does support start and stop (actually it maybe just exports the new and close actions right now, but it could export the start and stop names too).

1 Like