hi, i have a question regarding new structured cor...
# coroutines
n
hi, i have a question regarding new structured coroutines. In here it says https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/basics.md#scope-builder
The main difference between runBlocking and coroutineScope is that the latter does not block the current thread while waiting for all children to complete.
But when i run the example there the nested launch inside
coroutineScope
blocks the execution of the
runblocking
scope and the last
println("Coroutine scope is over")
is always printed the last. Am i getting it wrong? Or there is a mistake in the docs
k
coroutineScope
exits only after all the scoped coroutines have completed. However, it doesn’t block any thread. Once execution is suspended in the
coroutineScope
block, the thread is free to do some other work until the block is resumed again continuing from where it left off
n
ah ok, thanks @kingsley after rereading that blog post it makes sense now 🙂
👍 1