siglongjmp - non-local goto with signal handling
#include <setjmp.h> void siglongjmp(sigjmp_buf env, int val);
The siglongjmp() function restores the environment saved by the most recent invocation of sigsetjmp() in the same thread, with the corresponding sigjmp_buf argument. If there is no such invocation, or if the function containing the invocation of sigsetjmp() has terminated execution in the interim, the behaviour is undefined.All accessible objects have values as of the time sigsetjmp() was called, except that the values of objects of automatic storage duration which are local to the function containing the invocation of the corresponding sigsetjmp() which do not have volatile-qualified type and which are changed between the sigsetjmp() invocation and siglongjmp() call are indeterminate.
As it bypasses the usual function call and return mechanisms, siglongjmp() will execute correctly in contexts of interrupts, signals and any of their associated functions. However, if siglongjmp() is invoked from a nested signal handler (that is, from a function invoked as a result of a signal raised during the handling of another signal), the behaviour is undefined.
The siglongjmp() function will restore the saved signal mask if and only if the env argument was initialised by a call to sigsetjmp() with a non-zero savemask argument.
The effect of a call to siglongjmp() where initialisation of the jmp_buf structure was not performed in the calling thread is undefined.
After siglongjmp() is completed, program execution continues as if the corresponding invocation of sigsetjmp() had just returned the value specified by val. The siglongjmp() function cannot cause sigsetjmp() to return 0; if val is 0, sigsetjmp() returns the value 1.
No errors are defined.
None.
The distinction between setjmp() or longjmp() and sigsetjmp() or siglongjmp() is only significant for programs which use sigaction(), sigprocmask() or sigsuspend().
None.
longjmp(), setjmp(), sigprocmask(), sigsetjmp(), sigsuspend(), <setjmp.h>.
Derived from the ISO POSIX-1 standard.