3 ms·
Another interesting approach to lightweight cooperative threading is Protothreads [1][2]. Those are however stackless and make use of duff's device for the impl
by felixr 6y ago
Another interesting approach to lightweight cooperative threading is Protothreads [1][2]. Those are however stackless and make use of duff's device for the implementation; rather, than setjmp/longjmp.
[1] http://dunkels.com/adam/pt/ http://dunkels.com/adam/pt/
[2] https://en.wikipedia.org/wiki/Protothread https://en.wikipedia.org/wiki/Protothread
- mrpippy 6y agoOn GCC/Clang, pt uses goto and the “labels as values” GNU extension so it can avoid Duff’s device. This simplifies things, and allows yielding inside a switch statement.