Paul Woitaschek
11/19/2019, 8:13 AMtseisel
11/19/2019, 8:45 AMwithContext(myClassScope.coroutineContext) . I'm not sure it is good practice, but this seems to have the behavior you want.streetsofboston
11/19/2019, 12:27 PMPaul Woitaschek
11/19/2019, 12:56 PMstreetsofboston
11/19/2019, 12:59 PM... Let’s flip it around. What happens if that other CoroutineScope finishes, gets canceled? What would happen to the calling CoroutineScope? ...
...
... the calling Coroutine will be canceled, but the CoroutineScope in which it runs remains active ...
Paul Woitaschek
11/19/2019, 3:02 PMPaul Woitaschek
11/19/2019, 3:02 PMPaul Woitaschek
11/19/2019, 3:24 PMstreetsofboston
11/19/2019, 3:26 PMscope.async { … }.await() or just where the scope is the same one as the calling scope or do async { … }.await(), using withContext makes sense and the linter suggests that.
Using withContext to change scope seems wrong to me…. it probably works, but for some reason, it ‘looks’ wrong…Paul Woitaschek
11/19/2019, 3:26 PMPaul Woitaschek
11/19/2019, 3:26 PMPaul Woitaschek
11/19/2019, 3:26 PMPaul Woitaschek
11/19/2019, 3:27 PMstreetsofboston
11/19/2019, 3:27 PMstreetsofboston
11/19/2019, 3:27 PMCoroutineScope is more than just its coroutineContext (even though that is its only interface val).Paul Woitaschek
11/19/2019, 4:56 PMtseisel
11/19/2019, 8:05 PMCoroutineContext VS CoroutineScope from Roman's blog post : https://medium.com/@elizarov/coroutine-context-and-scope-c8b255d59055