NAME
mmaakkeeccoonntteexxtt, sswwaappccoonntteexxtt - modify and exchange user thread contexts
LLIIBBRRAARRYYStandard C Library (libc, -lc)
SYNOPSIS
##iinncclluuddee <
void mmaakkeeccoonntteexxtt(ucontextt *ucp, void (*func)(void), int argc, ...); int sswwaappccoonntteexxtt(ucontextt *oucp, const ucontextt *ucp);> DESCRIPTION
The mmaakkeeccoonntteexxtt() function modifies the user thread context pointed to by ucp, which must have previously been initialized by a call to getcontext(3) and had a stack allocated for it. The context is modified so that it will continue execution by invoking ffuunncc() with the arguments provided. The argc argument must be equal to the number of additionalarguments provided to mmaakkeeccoonntteexxtt() and also equal to the number of argu-
ments to ffuunncc(), or else the behavior is undefined.The ucp->uclink argument must be initialized before calling
mmaakkeeccoonntteexxtt() and determines the action to take when ffuunncc() returns: ifequal to NULL, the process exits; otherwise, sseettccoonntteexxtt(ucp->uclink) is
implicitly invoked. The sswwaappccoonntteexxtt() function saves the current thread context in *oucp and makes *ucp the currently active context.RETURN VALUES
If successful, sswwaappccoonntteexxtt() returns zero; otherwise -1 is returned and
the global variable errno is set appropriately. EERRRROORRSS The sswwaappccoonntteexxtt() function will fail if: [ENOMEM] There is not enough stack space in ucp to complete the operation.SEE ALSO
setcontext(3), ucontext(3) BSD September 10, 2002 BSD