From 465466ce4dcb0ca10e9efb3d0746fcee11a96b3f Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 1 Nov 2016 21:40:34 +0100 Subject: [PATCH] sigaction critical section refactor. * libguile/scmsigs.c (scm_sigaction_for_thread): Use critical section dynwinds instead of SCM_CRITICAL_SECTION_START. --- libguile/scmsigs.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c index b030b0413..d52fe8cba 100644 --- a/libguile/scmsigs.c +++ b/libguile/scmsigs.c @@ -334,7 +334,9 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, scm_i_ensure_signal_delivery_thread (); - SCM_CRITICAL_SECTION_START; + scm_dynwind_begin (0); + scm_dynwind_critical_section (SCM_BOOL_F); + old_handler = SCM_SIMPLE_VECTOR_REF (*signal_handlers, csig); if (SCM_UNBNDP (handler)) query_only = 1; @@ -353,7 +355,6 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, } else { - SCM_CRITICAL_SECTION_END; SCM_OUT_OF_RANGE (2, handler); } } @@ -440,7 +441,9 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, } if (old_action.sa_handler == SIG_DFL || old_action.sa_handler == SIG_IGN) old_handler = scm_from_long ((long) old_action.sa_handler); - SCM_CRITICAL_SECTION_END; + + scm_dynwind_end (); + return scm_cons (old_handler, scm_from_int (old_action.sa_flags)); #else if (query_only) @@ -459,7 +462,9 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, } if (old_chandler == SIG_DFL || old_chandler == SIG_IGN) old_handler = scm_from_long ((long) old_chandler); - SCM_CRITICAL_SECTION_END; + + scm_dynwind_end (); + return scm_cons (old_handler, scm_from_int (0)); #endif }