Guru
03/22/2019, 12:26 PMgildor
03/22/2019, 12:31 PMAntanas A.
03/22/2019, 12:36 PMGuru
03/22/2019, 12:39 PMrunBlocking
would have had not returned to main() as coroutineScope{...} continue execution. But, it's blocking even a expression below that.Antanas A.
03/22/2019, 12:40 PMGuru
03/22/2019, 12:41 PMAntanas A.
03/22/2019, 12:41 PMGuru
03/22/2019, 12:42 PMAntanas A.
03/22/2019, 12:44 PMGuru
03/22/2019, 12:44 PMtseisel
03/22/2019, 12:45 PMcoroutineScope
is NOT blocking. It suspends as long as it has non-completed children coroutines, which is the case because it has a children coroutine (launch2) that delays for a very very long time.
Note that runBlocking
has nothing to do with that ; even without runBlocking
, launch3 would have to wait until children of coroutineScope
have completed before resuming execution and reaching launch3.Antanas A.
03/22/2019, 12:45 PMGuru
03/22/2019, 12:46 PMAntanas A.
03/22/2019, 12:46 PMGuru
03/22/2019, 12:48 PMAntanas A.
03/22/2019, 3:54 PM