From 8e76ce94a28c02324aa13de835b1e55282b8b760 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 13 Apr 2011 12:03:50 +0200 Subject: [PATCH] --disable-threads fix * libguile/threads.c (do_thread_exit_trampoline, on_thread_exit): (scm_i_init_thread_for_guile): Only register and unregister threads with bdw-gc when we are building with threads support. Thanks to Marijn for the report. --- libguile/threads.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libguile/threads.c b/libguile/threads.c index 14bda1d2f..66869e7c3 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -661,7 +661,9 @@ static void * do_thread_exit_trampoline (struct GC_stack_base *sb, void *v) { /* Won't hurt if we are already registered. */ +#if SCM_USE_PTHREAD_THREADS GC_register_my_thread (sb); +#endif return scm_with_guile (do_thread_exit, v); } @@ -720,7 +722,7 @@ on_thread_exit (void *v) scm_i_pthread_setspecific (scm_i_thread_key, NULL); -#if !SCM_USE_NULL_THREADS +#if SCM_USE_PTHREAD_THREADS GC_unregister_my_thread (); #endif } @@ -774,7 +776,7 @@ scm_i_init_thread_for_guile (struct GC_stack_base *base, SCM parent) */ scm_i_init_guile (base); -#ifdef HAVE_GC_ALLOW_REGISTER_THREADS +#if defined (HAVE_GC_ALLOW_REGISTER_THREADS) && SCM_USE_PTHREAD_THREADS /* Allow other threads to come in later. */ GC_allow_register_threads (); #endif @@ -789,7 +791,9 @@ scm_i_init_thread_for_guile (struct GC_stack_base *base, SCM parent) scm_i_pthread_mutex_unlock (&scm_i_init_mutex); /* Register this thread with libgc. */ +#if SCM_USE_PTHREAD_THREADS GC_register_my_thread (base); +#endif guilify_self_1 (base); guilify_self_2 (parent); -- 2.20.1