chansek
04/16/2019, 10:33 AMoctylFractal
04/16/2019, 10:34 AMlaunch
is async, so while in the first case the delay(500L)
inside coroutineScope
prevented the last line from executing until after launch
had finished, it doesn't do that in this casechansek
04/16/2019, 10:37 AMoctylFractal
04/16/2019, 10:38 AMcoroutineScope
suspends until all inside coroutines are complete, including `launch`escoroutineScope
docs:
This function returns as soon as given block and all its children coroutines are completed.
chansek
04/16/2019, 10:39 AMoctylFractal
04/16/2019, 10:40 AMlaunch
in the coroutineScope
will actually run async to the delay(100L)
, despite runBlocking
only having one threaddelay
blocked, it wouldn't run until after the println("... from coroutine scope")
chansek
04/16/2019, 10:44 AMhalim
04/18/2019, 12:01 PM