DEV Community

Discussion on: Implementation of Coroutine in C Language

ac000 profile image
Andrew Clayton

I think it's worth pointing out that getcontext(3), setcontext(3), makecontext(3), and swapcontext(3) were obsoleted in POSIX.1-2004 and removed in POSIX.1-2008. I.e Linux man page has this to say

SUSv2, POSIX.1-2001. POSIX.1-2008 removes the specification of
getcontext(), citing portability issues, and recommending that
applications be rewritten to use POSIX threads instead.

and Wikipedia

setcontext was specified in POSIX.1-2001 and the Single Unix Specification, version 2, but not all Unix-like operating systems provide them. POSIX.1-2004 obsoleted these functions, and in POSIX.1-2008 they were removed, with POSIX Threads indicated as a possible replacement.

visheshpatel profile image
Vishal Chovatiya Author

Thanks for pointing that out.