COHERENT manpages
This page displays the COHERENT manpage for longjmp() [Perform a non-local goto].
List of available manpages
Index
longjmp() -- General Function (libc) Perform a non-local goto #include <setjmp.h> int longjmp(env, rval) jmp_buf env; int rval; The function call is the only mechanism that C provides to transfer control between functions. This mechanism is inadequate for some purposes, such as handling unexpected errors or interrupts at lower levels of a program. To answer this need, longjmp provides a non-local goto. longjmp() restores an environment that had been saved by a previous call to the function setjmp(). It returns the value rval to the caller of setjmp(), just as if the setjmp() call had just returned. Note that longjmp() must not restore the environment of a routine that has already returned. The type declaration for jmp_buf is in the header file setjmp.h. The environment saved includes the program counter, stack pointer, and stack frame. These routines do not restore register variables in the environment returned. Example For an example of this function, see the entry for setjmp(). See Also libc, setjmp(), siglongjmp() ANSI Standard, §7.6.2.1 POSIX Standard, §8.1 Notes Programmers should note that many user-level routines cannot be interrupted and reentered safely. For that reason, improper use of longjmp() and setjmp() can result in the creation of mysterious and irreproducible bugs. Do not attempt to use longjmp() within an exception handler.