vineethraj49
09/15/2019, 1:11 PMevery function that is declared as extension on CoroutineScope returns immediately, but performs its actions concurrently with the rest of the program.i.e.,
suspend fun
is a non-blocking, waiting function; while functions declared on CoroutineScope.foo
are non-blocking, “spawn something else concurrently” function;
what is the idiomatic way to do this in a class that already inherits CoroutineScope
?vineethraj49
09/15/2019, 1:12 PMlaunch
the primary differentiator?Dominaezzz
09/15/2019, 1:37 PMCoroutineScope
.Dominaezzz
09/15/2019, 1:43 PMCoroutineScope
.vineethraj49
09/15/2019, 2:30 PMclass Foo(ctx) : CoroutineScope by CoroutineScope(ctx) {
suspend fun foo1() { ... }
suspend fun foo2() { ... }
...
suspend fun run() {
foo1()
foo2()
...
}
}
now I realize that foo1 .. fooN will have the same scope as run anyway
---
other possibility is I still haven’t grok’ed scope inheritance