#include #include #include "riverguile.h" static void *call_exit_handler_inner (void *data) { assert(data == NULL); return scm_call_0(context.exit_handler); } void *call_exit_handler (void) { assert(context.exit_handler != NULL); /* Continuation barrier causes stack unwind on exceptions (i.e. errors * in the user defined exit handler) to stop here. Otherwise the entire * stack created by scm_with_guile() would be unwound. This makes * responding to exceptions nicer. */ SCM call_result = scm_c_with_continuation_barrier( call_exit_handler_inner, NULL ); if ( call_result == NULL ) return (void *)"ERROR: An exception occured while calling the exit handler.\n"; return NULL; }