vineethraj49
02/13/2020, 7:59 PMblock: suspend () -> T
and block: suspend CoroutineScope.() -> T
types?octylFractal
02/13/2020, 8:02 PMsuspend
one and the CoroutineScope
one -- and it's not clear which one will be usedsuspend () -> T
, indicating that it's a normal suspend function that will actually suspend while doing work, or with CoroutineScope.() -> T
, which indicates that it will launch a separate coroutine that won't suspend this codepath. usually T
will contain some reference to the Job that was started in this case.Evan R.
02/13/2020, 8:04 PMblock()
to use coroutineScope {}
to launch its coroutines and therefore all launched coroutines in block()
are guaranteed to complete with that signaturelouiscad
02/15/2020, 8:04 AMlaunch
, async
and coroutineScope
lambdas. If a custom function creates an inner scope as well, it's totally okay, it's totally to have the lambda(s) have that signature.