Merge remote-tracking branch 'local-2.0/stable-2.0'
[bpt/guile.git] / libguile / gc.c
index 5f61a1d..2c026b7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -227,6 +227,10 @@ scm_t_c_hook scm_after_gc_c_hook;
 static void
 run_before_gc_c_hook (void)
 {
+  if (!SCM_I_CURRENT_THREAD)
+    /* GC while a thread is spinning up; punt.  */
+    return;
+
   scm_c_hook_run (&scm_before_gc_c_hook, NULL);
 }
 
@@ -643,6 +647,7 @@ scm_storage_prehistory ()
 }
 
 scm_i_pthread_mutex_t scm_i_gc_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (scm_i_gc_admin_mutex);
 
 void
 scm_init_gc_protect_object ()