libunwind-setjmp(3)

libunwind-setjmp -- libunwind-based non-local gotos

Synopsis

#include <setjmp.h>

int setjmp(jmp_buf env);
void longjmp(jmp_buf env, int val);
int _setjmp(jmp_buf env);
void _longjmp(jmp_buf env, int val);
int setjmp(sigjmp_buf env, int savemask);
void siglongjmp(sigjmp_buf env, int val);

Description

The unwind-setjmp library offers a libunwind-based implementation of non-local gotos. This implementation is intended to be a drop-in replacement for the normal, system-provided routines of the same name. The main advantage of using the unwind-setjmp library is that setting up a non-local goto via one of the setjmp() routines is very fast. Typically, just 2 or 3 words need to be saved in the jump-buffer (plus one call to sigprocmask(2), in the case of sigsetjmp). On the other hand, executing a non-local goto by calling one of the longjmp() routines tends to be much slower than with the system-provided routines. In fact, the time spent on a longjmp() will be proportional to the number of call frames that exist between the points where setjmp() and longjmp() were called. For this reason, the unwind-setjmp library is beneficial primarily in applications that frequently call setjmp() but only rarely call longjmp().

Caveats

Files

-lunwind-setjmp
The library an application should be linked against to ensure it uses the libunwind-based non-local goto routines.

See Also

libunwind(3), setjmp(3), longjmp(3), _setjmp(3), _longjmp(3), sigsetjmp(3), siglongjmp(3)

Author

David Mosberger-Tang
Email: dmosberger@gmail.com
WWW: http://www.nongnu.org/libunwind/.