--disable-threads fix
authorAndy Wingo <wingo@pobox.com>
Wed, 13 Apr 2011 10:03:50 +0000 (12:03 +0200)
committerAndy Wingo <wingo@pobox.com>
Wed, 13 Apr 2011 10:50:36 +0000 (12:50 +0200)
* 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

index 14bda1d..66869e7 100644 (file)
@@ -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);