*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> getcontext (3)              
Title
Content
Arch
Section
 

GETCONTEXT(3)

Contents


NAME    [Toc]    [Back]

     getcontext, setcontext -- get and set user thread context

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <ucontext.h>

     int
     getcontext(ucontext_t *ucp);

     int
     setcontext(const ucontext_t *ucp);

DESCRIPTION    [Toc]    [Back]

     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 setcontext(), 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 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    [Toc]    [Back]

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

ERRORS    [Toc]    [Back]

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

SEE ALSO    [Toc]    [Back]

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


FreeBSD 5.2.1		      September 10, 2002		 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
ucontext FreeBSD user thread context
cpu_throw FreeBSD switch to another thread context
cpu_switch FreeBSD switch to another thread context
mi_switch FreeBSD switch to another thread context
glccontext IRIX make a context current to a thread
thread_exit FreeBSD abandon current thread context
pthread_switch_delete_np FreeBSD thread context switches debugging primitives
pthread_switch_add_np FreeBSD thread context switches debugging primitives
ucontext Tru64 user context
ucontext IRIX user context
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service