longjmp(), _longjmp()

restore environment saved by setjmp() 

Function


SYNOPSIS

#include <setjmp.h>

void longjmp(jmp_buf env, int val);

void _longjmp(jmp_buf env, int val);


DESCRIPTION

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:

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().


PARAMETERS

env 

Is the buffer where the calling thread's environment has been saved.

val 

Is the preferred return value from setjmp().


RETURN VALUES

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.


CONFORMANCE

longjmp(): ANSI/ISO 9899-1990, with exceptions.

_longjmp(): UNIX 98, with exceptions


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
_setjmp(), setjmp(), siglongjmp(), sigsetjmp()


PTC MKS Toolkit 10.4 Documentation Build 39.