setjmp

OS/161 Reference Manual

Name

setjmp, longjmp - non-local jump operations

Library

Standard C Library (libc, -lc)

Synopsis

#include <setjmp.h>

int
setjmp(jmp_buf jb);

void
longjmp(jmp_buf jb, int returncode);

Description

setjmp saves the current stack frame and processor state in jb. A subsequent call to longjmp with the same jb causes execution to jump to where setjmp was called from.

If the stack frame that called setjmp returns before longjmp is called, the results are undefined.

Return Values

When called, setjmp returns 0. When longjmp is called, it does not itself return, but instead causes setjmp to appear to return again, this time returning returncode.

If zero is passed as returncode, the value 1 is used instead.