3 ms·
makecontext/swapcontext was the POSIX approved way to do fibers. It was removed from the last POSIX standard because who uses coroutines or fibers today? Around
by gpderetta 10y ago
makecontext/swapcontext was the POSIX approved way to do fibers. It was removed from the last POSIX standard because who uses coroutines or fibers today? Around the same time every other mainstream language was adding support for corutines/generators/fibers.
- wolfgke 10y agomakecontext/swapcontex doesn't have automatically growing stack (opposed to their WinAPI equivalents). Yes, you can do this, too, I know. But if you don't want to go into the gory details here you either have a alloc a "large enough" buffer for your coroutines thus probably wasting memory.
- gpderetta 10y agotechnically you only waste address space which should be plenty enough at least for a while.