Loading the code workspace…
Add coroutine support to your VM in C.
Requirements:
Test:
YIELD/RESUME saving and restoring PC, stack, and frame state is exactly how Lua's native coroutines (lua_yield/lua_resume) work, and it's the same mechanism CPython's generators use under PEP 342 to implement 'yield' and, ultimately, asyncio's event loop. The producer-consumer pattern you build here is the textbook use case for both.