summaryrefslogtreecommitdiff
path: root/libguile/async.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/async.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/async.h')
-rw-r--r--libguile/async.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/libguile/async.h b/libguile/async.h
index 427d9b4c8..b9b795f4f 100644
--- a/libguile/async.h
+++ b/libguile/async.h
@@ -60,20 +60,18 @@ void scm_dynwind_unblock_asyncs (void);
the manual.
*/
-/* Defined in threads.c. scm_i_critical_section_level is only used
- for error checking and will go away eventually. */
+/* Defined in threads.c. */
extern scm_i_pthread_mutex_t scm_i_critical_section_mutex;
-extern int scm_i_critical_section_level;
#define SCM_CRITICAL_SECTION_START \
do { \
scm_i_pthread_mutex_lock (&scm_i_critical_section_mutex);\
SCM_I_CURRENT_THREAD->block_asyncs++; \
- scm_i_critical_section_level++; \
+ SCM_I_CURRENT_THREAD->critical_section_level++; \
} while (0)
#define SCM_CRITICAL_SECTION_END \
do { \
- scm_i_critical_section_level--; \
+ SCM_I_CURRENT_THREAD->critical_section_level--; \
SCM_I_CURRENT_THREAD->block_asyncs--; \
scm_i_pthread_mutex_unlock (&scm_i_critical_section_mutex); \
scm_async_click (); \