Ucontext in linux

给你一囗甜甜゛ 提交于 2019-12-04 13:02:10

ucontext.h defines functions (setcontext, getcontext, makecontext, and swapcontext) and structures (ucontext_t and mcontext_t) that allow the programmer to save and restore the program context.

Using these functions, a programmer can implement advanced flow control schemes, such as coroutines or lightweight user threads.

A good amount of detail (including an example of implementing coroutines) is given in the GNU C Library: Complete Context Control.

It should be noted ucontext.h was obsoleted in POSIX.1-2008 ("IEEE Std 1003.1-2001/Cor 2-2004, item XBD/TC2/D6/28 is applied, updating the getcontext(), makecontext(), setcontext(), and swapcontext() functions to be obsolescent." on the ucontext.h page ).)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!