Performs stack and register save operation, ready for a non-local jump.
int setjmp (jmp_buf save_jmp);
Required Header |
<setjmp.h> |
Return Value
This function returns zero on the first return. A non-zero value is returned if the return was caused by a call to the longjmp function.
Parameters
save_jmp
An area to save the stack and register state
Remarks
The setjmp function saves the stack and register state into save_jmp and returns zero. This function may return a second time with a non-zero return value if a call to longjmp is executed before the function that called setjmp has returned. The results are unpredictable if the function that calls setjmp returns before longjmp is executed.
The thread that called setjmp is the only thread allowed to use the saved state.
See Also longjmp