elizarov
06/28/2017, 7:46 AMinvokeOnCompletion
is designed to be synchronous, because it is the low-level plumbing that enables waiting for completion (joining) to work. However, with respect to cancellation in particular it is going to change (and the changes are already committed to develop
branch). See this discussion: https://github.com/Kotlin/kotlinx.coroutines/issues/64