diff options
author | Ludovic Courtès <ludo@gnu.org> | 2011-06-30 22:58:07 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2011-06-30 22:58:07 +0200 |
commit | b8441577f9954053a90981a5c134aa43f341f712 (patch) | |
tree | 0f7302c46cbc0f87f8b0936d6efb967a8ba7e03f /libguile/threads.c | |
parent | ea5c9ddcebe1d798fccfe9bbb1f4504e77fa2908 (diff) | |
download | guile-b8441577f9954053a90981a5c134aa43f341f712.tar.gz |
Fix `on_thread_exit' for canceled threads.
* libguile/threads.c (on_thread_exit): Clear `t->guile_mode' upon
entry. This fixes a bug whereby `t->base' would be incorrect for
canceled threads, leading to a misdiagnosed VM stack overflow.
See <http://lists.gnu.org/archive/html/bug-guile/2011-06/msg00068.html>
for details.
(scm_leave_guile_cleanup): Remove because it's unused.
Diffstat (limited to 'libguile/threads.c')
-rw-r--r-- | libguile/threads.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libguile/threads.c b/libguile/threads.c index c07c85342..0c6b8b40b 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -696,6 +696,10 @@ on_thread_exit (void *v) /* This handler is executed in non-guile mode. */ scm_i_thread *t = (scm_i_thread *) v, **tp; + /* If we were canceled, we were unable to clear `t->guile_mode', so do + it here. */ + t->guile_mode = 0; + /* If this thread was cancelled while doing a cond wait, it will still have a mutex locked, so we unlock it here. */ if (t->held_mutex) @@ -835,12 +839,6 @@ scm_init_guile () } } -SCM_UNUSED static void -scm_leave_guile_cleanup (void *x) -{ - on_thread_exit (SCM_I_CURRENT_THREAD); -} - struct with_guile_args { GC_fn_type func; |