|
|
#include <ucontext.h>int getcontext(ucontext_t *ucp);
int setcontext(ucontext_t *ucp);
These functions are useful for implementing user level context switching between multiple threads of control within a process.
getcontext initializes the structure pointed to by ucp to the current user context of the calling thread. The user context is defined by ucontext(FP) and includes the contents of the calling thread's machine registers, signal mask and execution stack.
setcontext restores the user context pointed to by ucp. A successful call to setcontext does not return; program execution resumes at the point specified by the context structure passed to setcontext. The context structure should have been one created either by a prior call to getcontext or makecontext or passed as the third argument to a signal handler (see sigaction(S-osr5)). If the context structure was one created with getcontext, program execution continues as if the corresponding call of getcontext had just returned. If the context structure was one created with makecontext, program execution continues with the function specified to makecontext.
AT&T SVID Issue 3.