I want to know whether coroutineScope
will be auto-canceled after its work is finished. Say I create a coroutineScope
in a custom class Rather Than ViewModel
class or Fragment / Activity
class:
class MyClass {
private val backgroundScope = CoroutineScope(Dispatchers.Default)
fun doSomething() = backgroundScope.launch {
//do background work
}
}
In this case, after the background work is done, would backgroundScope
auto-cancel itself?