getcontext man page on FreeBSD

Man page or keyword search:  
man Server   9747 pages
apropos Keyword Search (all sections)
Output format
FreeBSD logo
[printable version]

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

     getcontext, setcontext — get and set user thread context

     Standard C Library (libc, -lc)

     #include <ucontext.h>

     getcontext(ucontext_t *ucp);

     setcontext(const ucontext_t *ucp);

     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 con‐
     text 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 specified to makecontext(3).  When that func‐
     tion 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.

     If successful, getcontext() returns zero and setcontext() does not
     return; otherwise -1 is returned.

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

     sigaction(2), sigaltstack(2), makecontext(3), ucontext(3)

BSD			      September 10, 2002			   BSD

List of man pages available for FreeBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net