I recently wrote a small public domain coroutine library that weighs in under 100 lines without comments (https://github.com/maxburke/coroutine). It's targeted toward MSVC/x86 but it wouldn't be that hard to port to other platforms, or plain C.
It has a few restrictions, it expects that the stack frame for the threads doesn't exceed 4kb, although it could be made more flexible I figured that OS fiber facilities would be more appropriate if heavier weight features were required.
It has a few restrictions, it expects that the stack frame for the threads doesn't exceed 4kb, although it could be made more flexible I figured that OS fiber facilities would be more appropriate if heavier weight features were required.