3 ms·
There's an implementation using setjmp/longjmp in his library here [1]. It uses sigaltstack to assign a newly allocated stack to the coroutine. Marc Lehman's l
by jjjordan 7y ago
There's an implementation using setjmp/longjmp in his library here [1]. It uses sigaltstack to assign a newly allocated stack to the coroutine. Marc Lehman's libcoro [2] library does the same.
[1] https://github.com/byuu/higan/blob/master/libco/sjlj.c https://github.com/byuu/higan/blob/master/libco/sjlj.c
[2] http://software.schmorp.de/pkg/libcoro.html http://software.schmorp.de/pkg/libcoro.html
- gpderetta 7y agoas an historical note, the sigaltstack trick was popularized, if not invented, by the Pth library.