CoroutineStart.DEFAULT调用时间是不固定的
多个协程调调用 每个自协程不是顺序调用
Log.d("Corountines", "111") GlobalScope.launch(start = CoroutineStart.DEFAULT) { Log.d("Corountines", "222") } Log.d("Corountines", "333") GlobalScope.launch(start = CoroutineStart.DEFAULT) { Log.d("Corountines", "444") } Log.d("Corountines", "555") GlobalScope.launch(start = CoroutineStart.DEFAULT) { Log.d("Corountines", "666") } Log.d("Corountines", "777")复制代码
会出现
Corountines: 1Corountines: 2Corountines: 3Corountines: 4Corountines: child_3Corountines: child_1Corountines: child_2复制代码
或者
123child_1child_3child_24复制代码