nerses
09/27/2018, 2:51 PMThe 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 docskingsley
09/27/2018, 2:55 PMcoroutineScope
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 offkingsley
09/27/2018, 2:57 PMnerses
09/27/2018, 3:53 PM