This manual page is for Mac OS X version 10.6.3

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • For more information about the manual page format, see the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Reference Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.



MAKECONTEXT(3)                          BSD Library Functions Manual                          MAKECONTEXT(3)

NAME
     makecontext, swapcontext -- modify and exchange user thread contexts

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <ucontext.h>

     void
     makecontext(ucontext_t *ucp, void (*func)(), int argc, ...);

     int
     swapcontext(ucontext_t *oucp, const ucontext_t *ucp);

DESCRIPTION
     The makecontext() function modifies the user thread context pointed to by ucp, which must have previ-ously previously
     ously 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 func() with the arguments (of type int) pro-vided. provided.
     vided.  The argc argument must be equal to the number of additional arguments provided to makecontext()
     and also equal to the number of arguments to func(), or else the behavior is undefined.

     The ucp->uc_link argument must be initialized before calling makecontext() and determines the action to
     take when func() returns: if equal to NULL, the process exits; otherwise, setcontext(ucp->uc_link) is
     implicitly invoked.

     The swapcontext() function saves the current thread context in *oucp and makes *ucp the currently
     active context.

RETURN VALUES
     If successful, swapcontext() returns zero; otherwise -1 is returned and the global variable errno is
     set appropriately.

ERRORS
     The swapcontext() 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

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.

Did this document help you? Yes It's good, but... Not helpful...