swapcontext man page on FreeBSD

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

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

     makecontext, swapcontext — modify and exchange user thread contexts

     Standard C Library (libc, -lc)

     #include <ucontext.h>

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

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

     The makecontext() function modifies the user thread context pointed to by
     ucp, which must have previously 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
     provided.	The argc argument must be equal to the number of additional
     arguments provided to makecontext() and also equal to the number of argu‐
     ments 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.

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

     The swapcontext() function will fail if:

     [ENOMEM]		There is not enough stack space in ucp to complete the

     setcontext(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