Name

ECL_UNWIND_PROTECT_BEGIN — C macro for unwind-protect

Synopsis

ECL_UNWIND_PROTECT_BEGIN(env) {
} ECL_UNWIND_PROTECT_EXIT {
} ECL_UNWIND_PROTECT_END;

Description

ECL_UNWIND_PROTECT_BEGIN establishes two blocks of C code that work like the equivalent ones in Common Lisp: a protected block, contained between the "BEGIN" and the "EXIT" statement, and the exit block, appearing immediately afterwards. The form guarantees that the exit block is always executed, even if the protected block attempts to exit via som nonlocal jump construct (throw,return, etc).

env must be the value of the current Common Lisp environment, obtained with ecl_process_env.

The utility of this construct is limited, for it only protects against nonlocal exits caused by Common Lisp constructs: it does not interfere with C goto, return or with C++ exceptions.