资 源 简 介
Coroutines are (quoting wikipedia):
program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations.
While in many modern languages coroutines are built-in (Python being the most notable example) or similar, often simplified, constructs are provided (like C#"s yield), Java lacks any coroutine support - even in this simplified form. I found this situation uncomfortable, because many times I had been struck with feeling that any coroutine support would have greatly helped with a problem at hand.
After reading inspirational article about coroutine support in C, which you can find here and inspecting potential JVM constraints, it became clear that coroutines could be implemented on bytecode level using 请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报