The
getcontext() function initializes the object pointed to by
ucp to the current user context of the calling thread. The user context defines a thread's execution environment and includes the contents of its machine registers, its signal mask, and its current execution stack.
The
setcontext() function restores the user context defined in the object pointed to by
ucp as most recently initialized by a previous call to either
getcontext() or
makecontext(3). If successful, execution of the program resumes as defined in the
ucp argument, and
setcontext() will not return. If
ucp was initialized by the
getcontext() function, program execution continues as if the corresponding invocation of
getcontext() had just returned (successfully). If
ucp was initialized by the
makecontext(3) function, program execution continues with the function (and function arguments) passed to
makecontext(3).