2.3. select/poll based state machines
To overcome the code maintainability issue of this approach, one might use a user space threading library like
GNU pth, or employ user land stack switching using
makecontext(3) and
swapcontext(3) or
setjmp(3),
longjmp(3) and
sigaltstack(2). GNU pth actually uses the latter;
a paper describing this approach in depth is available.