我开始学习coroutine,并尝试运行示例结构化并发的代码。但我得到了另一个结果。如果将delay(1000L) 设置为“你好”,则只打印和Process finished with exit code -1073741819 (0xC0000005)。但是如果我设置delay(100L),我就会得到“你好,世界!”。为什么launch{}块不启动?
import kotlinx.coroutines.*
fun main() = runBlocking { // this: CoroutineScope
launch { // launch a new coroutine in the scope of runBlocking
delay(100L)
println("World!")
}
println("Hello,")
}发布于 2019-06-26 08:45:40
好的,我禁用了程序“”,现在所有的程序都正常工作。
https://stackoverflow.com/questions/56056618
复制相似问题