#include <setjmp.h>
void longjmp(jmp_buf env, int val);
void _longjmp(jmp_buf env, int val);
The longjmp() function restores the environment saved
by the most recent invocation of setjmp()
in the same thread, with the corresponding env argument.
If there is no such invocation, or if the function containing the invocation
of setjmp() has terminated execution in the interim,
the behavior is undefined. The longjmp() function does not
restore the signal mask for the thread; refer instead to
siglongjmp().
All accessible objects have values as of the time setjmp()
was called, except that the values of objects of automatic storage are
indeterminate if they meet all of the following conditions:
-
They are local to the function containing the corresponding
setjmp() invocation.
-
They are not qualified with volatile.
-
They are changed between the setjmp() invocation and
longjmp() call.
As it bypasses the usual function call and return mechanisms,
longjmp() executes correctly in contexts of interrupts
and any of their associated functions.
However, if longjmp() is invoked
from a nested signal handler (that is, from a function invoked as
a result of signal raised during the handling of another signal),
the behavior is undefined.
The _longjmp() function
behaves identically to longjmp().
- env
-
Is the buffer where the calling thread's environment has been saved.
- val
-
Is the preferred return value from setjmp().
After longjmp() is completed, program execution continues
as if the corresponding invocation of setjmp() had just
returned with the value specified by val.
The longjmp() function cannot
cause setjmp() to return 0; if val is 0,
setjmp() returns 1.
longjmp(): ANSI/ISO 9899-1990, with exceptions.
_longjmp(): UNIX 98, with exceptions
MT-Safe.
None.
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
- Functions:
- _setjmp(), setjmp(), siglongjmp(), sigsetjmp()
MKS Toolkit 9.2 Documentation Build 16.