4 ms·
Interesting to compare and contrast with Simon Tatham's method of implementing Co-Routines in C: https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html h
by ColinWright 6y ago
Interesting to compare and contrast with Simon Tatham's method of implementing Co-Routines in C:
https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
Submitted here: https://news.ycombinator.com/item?id=23293835 https://news.ycombinator.com/item?id=23293835
That's decades old, and actually used in PuTTY.
- brenns10 6y agoThat's really cool, and much lighter weight for the purpose of coroutines!
- SV_BubbleTime 6y agoStill looking for something appropriately handle blocking and resuming without a full RTOS, but I do like both these options.
- ChickeNES 6y agoAnd libco: https://byuu.net/design/cooperative-threading https://byuu.net/design/cooperative-threading
- fanf2 6y agoNote that SGT's coroutines are stackless, whereas this article's coroutines have their own stack. It's also worth noting that you don't need asm to change the stack pointer, if you don't mind being imprecise about its exact value by the size of a function invocation frame or so: you can use alloca() or variable length arrays to do arithmetic on the stack pointer! https://fanf.livejournal.com/105413.html https://fanf.livejournal.com/105413.html