elizarov
12/26/2016, 1:21 PMval myCancel = Cancellable()
, then start a coroutine (or multiple coroutines) with this cancellation token via async(myCancel) {}
or asycnGenerate(myCancel) {}
or with any other coroutine builder that accepts a dispatcher as parameter and then you can cancel all of them with just myCancel.cancel()
. Maybe it should be called Task
or something. The idea is that you can have some high-level task that spawns multiple coroutines in the process, but if that task is cancelled, then you need to abort all the coroutines that are running in its context.