#include <setjmp.h> int setjmp(jmp_buf j);
This function stores the complete CPU state into j. This
information is complete enough that longjmp
(see section longjmp) can
return the program to that state. It is also complete enough to
implement coroutines.
This function will return zero if it is returning from it's own call. If longjmp is used to restore the state, it will return whatever value was passed to longjmp, except if zero is passed to longjmp it will return one.
ANSI, POSIX
jmp_buf j; if (setjmp(j)) return; do_something(); longjmp(j, 1);
Go to the first, previous, next, last section, table of contents.