From 87f30eda98b9c84807d54af6c76b6195c5cbd009 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Tue, 10 Mar 2009 23:55:31 +0000 Subject: Fix spurious `throw from within critical section' errors The crux of this problem was that the thread doing a throw, and so checking scm_i_critical_section_level, was different from the thread that was in a critical section. * libguile/async.h (scm_i_critical_section_level): Removed, replaced by per-thread critical_section_level. (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END): Use per-thread critical_section_level. * libguile/continuations.c (scm_dynthrow): Check per-thread critical_section_level. * libguile/threads.c (guilify_self_1): Init per-thread critical_section_level. (scm_i_critical_section_level): Removed. * libguile/threads.h (scm_i_thread): New critical_section_level field. * libguile/throw.c (scm_ithrow): Check per-thread critical_section_level. --- libguile/threads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libguile/threads.c') diff --git a/libguile/threads.c b/libguile/threads.c index 8dce6043c..901695cfe 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -318,6 +318,7 @@ guilify_self_1 (SCM_STACKITEM *base) t->active_asyncs = SCM_EOL; t->block_asyncs = 1; t->pending_asyncs = 1; + t->critical_section_level = 0; t->last_debug_frame = NULL; t->base = base; #ifdef __ia64__ @@ -1855,7 +1856,6 @@ static int threads_initialized_p = 0; /* This mutex is used by SCM_CRITICAL_SECTION_START/END. */ scm_i_pthread_mutex_t scm_i_critical_section_mutex; -int scm_i_critical_section_level = 0; static SCM dynwind_critical_section_mutex; -- cgit v1.2.3