summaryrefslogtreecommitdiff
path: root/libguile/threads.h
diff options
context:
space:
mode:
authorNeil Jerram <neil@ossau.uklinux.net>2009-03-10 23:55:31 +0000
committerNeil Jerram <neil@ossau.uklinux.net>2009-09-30 21:44:02 +0100
commit87f30eda98b9c84807d54af6c76b6195c5cbd009 (patch)
tree68c075350ed8489ac6230115359c6a31db95474f /libguile/threads.h
parent09d978f3f81d7ae43ba952de8dc568f54f5f80b6 (diff)
downloadguile-87f30eda98b9c84807d54af6c76b6195c5cbd009.tar.gz
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.
Diffstat (limited to 'libguile/threads.h')
-rw-r--r--libguile/threads.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libguile/threads.h b/libguile/threads.h
index 55102df17..842f0d9d0 100644
--- a/libguile/threads.h
+++ b/libguile/threads.h
@@ -117,6 +117,9 @@ typedef struct scm_i_thread {
scm_t_contregs *pending_rbs_continuation;
#endif
+ /* Whether this thread is in a critical section. */
+ int critical_section_level;
+
} scm_i_thread;
#define SCM_I_IS_THREAD(x) SCM_SMOB_PREDICATE (scm_tc16_thread, x)