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.



GETCONTEXT(3)                           BSD Library Functions Manual                           GETCONTEXT(3)

NAME
     getcontext, setcontext -- get and set user thread context

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <ucontext.h>

     int
     getcontext(ucontext_t *ucp);

     int
     setcontext(const ucontext_t *ucp);

DESCRIPTION
     The getcontext() 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 setcontext().

     The setcontext() function makes a previously saved thread context the current thread context, i.e., the
     current context is lost and setcontext() does not return.  Instead, execution continues in the context
     specified by ucp, which must have been previously initialized by a call to getcontext(),
     makecontext(3), or by being passed as an argument to a signal handler (see sigaction(2)).

     If ucp was initialized by getcontext(), then execution continues as if the original getcontext() call
     had just returned (again).

     If ucp was initialized by makecontext(3), execution continues with the invocation of the function spec-ified specified
     ified to makecontext(3).  When that function returns, ucp->uc_link determines what happens next: if
     ucp->uc_link is NULL, the process exits; otherwise, setcontext(ucp->uc_link) 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, getcontext() returns zero and setcontext() does not return; otherwise -1 is returned.

ERRORS
     No errors are defined for getcontext() or setcontext().

SEE ALSO
     sigaction(2), sigaltstack(2), makecontext(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...