4 ms·
That's too bad indeed. How would one implement coroutines in Linux/Unix today then?
by elteto 8y ago
That's too bad indeed. How would one implement coroutines in Linux/Unix today then?
- sanxiyn 8y agoPython's greenlet extension implements coroutine using inline assembly, which has been widely ported (at least ARM and x86, both 32-bit and 64-bit). It's nicely packaged so that you can use it without Python part.
- gpderetta 8y agoboost has a coroutine api. It provide both low level (untyped C-like) and high level APIs.
- thestoicattack 8y agoI guess wait for libstdc++ to implement the Coroutines TS that got merged into the C++20 standard?
- spc476 8y agoUsually using C's `setjmp()` and `longjmp()` functions (but I consider that an ugly hack). I did an implementation for both x86-32 and x86-64 [1] that works for Linux and Mac OS-X that's for C (written in assembly). I doubt it will work for C++, and I'd be a bit hesitant to use it for production, but it's surprisingly simple. [1] https://github.com/spc476/C-Coroutines https://github.com/spc476/C-Coroutines Edit: clarification of what language my coroutines are implemented in.