>From 6392638ac9a0177911eb63091c94c52638b08914 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Wed, 21 Dec 2011 20:29:24 +0000 Subject: [PATCH] Attempted GC/threads fix for ARM --- libguile/threads.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libguile/threads.c b/libguile/threads.c index 7523540..388f815 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -744,8 +744,13 @@ on_thread_exit (void *v) scm_i_pthread_setspecific (scm_i_thread_key, NULL); +#ifdef SCM_HAVE_THREAD_STORAGE_CLASS + /* Cache the current thread in TLS for faster lookup. */ + scm_i_current_thread = NULL; +#endif + #if SCM_USE_PTHREAD_THREADS - GC_unregister_my_thread (); + //GC_unregister_my_thread (); #endif } @@ -754,7 +759,7 @@ static scm_i_pthread_once_t init_thread_key_once = SCM_I_PTHREAD_ONCE_INIT; static void init_thread_key (void) { - scm_i_pthread_key_create (&scm_i_thread_key, on_thread_exit); + scm_i_pthread_key_create (&scm_i_thread_key, NULL/* on_thread_exit */); } /* Perform any initializations necessary to make the current thread @@ -866,6 +871,8 @@ with_guile_and_parent (struct GC_stack_base *base, void *data) t = SCM_I_CURRENT_THREAD; if (new_thread) { + pthread_cleanup_push (on_thread_exit, SCM_I_CURRENT_THREAD); + /* We are in Guile mode. */ assert (t->guile_mode); @@ -873,6 +880,8 @@ with_guile_and_parent (struct GC_stack_base *base, void *data) /* Leave Guile mode. */ t->guile_mode = 0; + + pthread_cleanup_pop (1); } else if (t->guile_mode) { -- 1.7.7.3