Comment by Nursie
Cooperative multithreading via setjmp and longjmp has been around in C since the 80s at least.
I’m not sure this is so much hacking as an accepted technique from the old-old days which has somewhat fallen out of favour, especially as C is falling a little outside of the mainstream these days.
Perhaps it’s almost becoming lost knowledge :)
This isn't using setjmp/longjmp
It's using Simon Tatham's method based on Duff's device (https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html)