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

  man pages->IRIX man pages -> standard/getcontext (2)              
Title
Content
Arch
Section
 

Contents


getcontext(2)							 getcontext(2)


NAME    [Toc]    [Back]

     getcontext, setcontext - get and set current user context

SYNOPSIS    [Toc]    [Back]

     #include <ucontext.h>

     int getcontext(ucontext_t *ucp);
     int setcontext(ucontext_t *ucp);

DESCRIPTION    [Toc]    [Back]

     These functions, along with those defined in makecontext(3C), are useful
     for implementing user level context switching between multiple threads of
     control within a process.

     getcontext	initializes the	structure pointed to by	ucp to the current
     user context of the calling process.  The user context is defined by
     ucontext(5) and includes the contents of the calling process's machine
     registers,	signal mask and	execution stack.

     setcontext	restores the user context pointed to by	ucp.  The call to
     setcontext	does not return;  program execution resumes at the point
     specified by the context structure	passed to setcontext.  The context
     structure should have been	one created either by a	prior call to
     getcontext	or makecontext or passed as the	third argument to a signal
     handler [see sigaction(2)].  If the context structure was one created
     with getcontext, program execution	continues as if	the corresponding call
     of	getcontext had just returned.  If the context structure	was one
     created with makecontext, program execution continues with	the function
     specified to makecontext.

NOTES    [Toc]    [Back]

     When a signal handler is executed,	the current user context is saved and
     a new context is created by the kernel.  If the process leaves the	signal
     handler via longjmp(3C) the original context will not be restored,	and
     future calls to getcontext	will not be reliable.  Signal handlers should
     use siglongjmp(3C)	or setcontext instead.

DIAGNOSTICS    [Toc]    [Back]

     On	successful completion, setcontext does not return and getcontext
     returns 0.	 Otherwise, a value of -1 is returned and errno	is set to
     indicate the error.

SEE ALSO    [Toc]    [Back]

      
      
     sigaction(2), sigaltstack(2), sigprocmask(2), makecontext(3C),
     ucontext(5).


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
glciscontext IRIX test whether a context ID is the current GLC context
ttyslot Tru64 Find the slot for the current user in the user accounting database
glcgetcurrentcontext IRIX return current context ID
glXGetCurrentDisplay Tru64 get display for current context
glxgetcurrentdisplay IRIX get display for current context
glxgetcurrentcontext IRIX return the current context
glXGetCurrentContext Tru64 return the current context
glxgetcurrentdisplayext IRIX returns the display for the current context
thread_exit FreeBSD abandon current thread context
glccontext IRIX make a context current to a thread
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service