NAME
ggeettccoonntteexxtt, sseettccoonntteexxtt - get and set user thread context
LLIIBBRRAARRYYStandard C Library (libc, -lc)
SYNOPSIS
##iinncclluuddee <
int ggeettccoonntteexxtt(ucontextt *ucp); int sseettccoonntteexxtt(const ucontextt *ucp);> DESCRIPTION
The ggeettccoonntteexxtt() function saves the current thread's execution context in the structure pointed to by ucp. This saved context may then later be restored by calling sseettccoonntteexxtt(). The sseettccoonntteexxtt() function makes a previously saved thread context the current thread context, i.e., the current context is lost andsseettccoonntteexxtt() does not return. Instead, execution continues in the con-
text specified by ucp, which must have been previously initialized by a call to ggeettccoonntteexxtt(), makecontext(3), or by being passed as an argument to a signal handler (see sigaction(2)). If ucp was initialized by ggeettccoonntteexxtt(), then execution continues as if the original ggeettccoonntteexxtt() call had just returned (again). If ucp was initialized by makecontext(3), execution continues with theinvocation of the function specified to makecontext(3). When that func-
tion returns, ucp->uclink determines what happens next: if ucp->uclink
is NULL, the process exits; otherwise, sseettccoonntteexxtt(ucp->uclink) is
implicitly invoked. If ucp was initialized by the invocation of a signal handler, execution continues at the point the thread was interrupted by the signal.RETURN VALUES
If successful, ggeettccoonntteexxtt() returns zero and sseettccoonntteexxtt() does notreturn; otherwise -1 is returned.
EERRRROORRSS No errors are defined for ggeettccoonntteexxtt() or sseettccoonntteexxtt().SEE ALSO
sigaction(2), sigaltstack(2), makecontext(3), ucontext(3) BSD September 10, 2002 BSD