Pablo
10/07/2020, 2:06 PMstreetsofboston
10/07/2020, 2:25 PMCoroutineScope.cancel()
basically does this.coroutineContext[Job]?.cancel()
. This will cause the scope’s top-Job, tied to the scope’s top coroutine, to be cancelled. No need to use Job itself.
Don’t cancel a dispatcher. Just cancel the scope.Pablo
10/07/2020, 2:31 PMstreetsofboston
10/07/2020, 2:33 PMstreetsofboston
10/07/2020, 2:34 PMdelay(….)
, which is a suspending function, will be cancelled if it is still waiting as soon its scope is cancelled.Pablo
10/07/2020, 2:35 PMstreetsofboston
10/07/2020, 2:35 PMstreetsofboston
10/07/2020, 2:36 PMPablo
10/07/2020, 2:37 PM