From 24e4c13d5817ec980f8214d74e41ef0bc0888d21 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sun, 18 Feb 2018 21:02:26 +0100 Subject: [PATCH] threading: block interrupts during execution of cleanup forms in unwind-protect If we don't do this, execution of the cleanup forms may be interrupted or they may not be executed at all. This behaviour would probably be acceptable for external code, however the unwind-protect mechanism is also used internally to protect against deadlocks (e.g. in ECL_WITH_(SPIN)LOCK). --- src/h/stacks.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/h/stacks.h b/src/h/stacks.h index a93b61b9f..efdbedd17 100755 --- a/src/h/stacks.h +++ b/src/h/stacks.h @@ -474,11 +474,14 @@ extern ECL_API ecl_frame_ptr _ecl_frs_push(register cl_env_ptr, register cl_obje #define ECL_UNWIND_PROTECT_EXIT \ __unwinding=0; } \ + ecl_bds_bind(__the_env,ECL_INTERRUPTS_ENABLED,ECL_T); \ ecl_frs_pop(__the_env); \ __nr = ecl_stack_push_values(__the_env); -#define ECL_UNWIND_PROTECT_END \ +#define ECL_UNWIND_PROTECT_END \ ecl_stack_pop_values(__the_env,__nr); \ + ecl_bds_unwind1(__the_env); \ + ecl_check_pending_interrupts(__the_env); \ if (__unwinding) ecl_unwind(__the_env,__next_fr); } while(0) #define ECL_NEW_FRAME_ID(env) ecl_make_fixnum(env->frame_id++)