out of an abundance of caution (and a general fear...
# coroutines
g
out of an abundance of caution (and a general fear of concurrency), I've written an extension function
Copy code
suspend fun Job.cancelAndJoin() = cancel().also { join() }
and am using it preferably to
cancel()
. My rationale is that
finally{}
and
catch{}
blocks in a coroutine might have it taking actions that I'd probably like to have happen sequentially. does it maye make sense to have an optional argument added ot the
cancel()
method to indicate which state you want it to return to you in (either
Cancelling
or
Cancelled-Completed
)?