[guile] Run finalizers from GDB thread
[deliverable/binutils-gdb.git] / gdb / guile / guile.c
index 16d15b7d6c2232295f03b087502093d5750c50a8..4abf5c5bb14537d20767a2e8caef01e30ae34d78 100644 (file)
@@ -704,6 +704,10 @@ call_initialize_gdb_module (void *data)
      performed within the desired module.  */
   scm_c_define_module (gdbscm_module_name, initialize_gdb_module, NULL);
 
+#if HAVE_GUILE_MANUAL_FINALIZATION
+  scm_run_finalizers ();
+#endif
+
   return NULL;
 }
 
@@ -850,6 +854,13 @@ _initialize_guile (void)
        side to define module "gdb" which imports "_gdb".  There is evidently no
        similar convention in Guile so we skip this.  */
 
+#if HAVE_GUILE_MANUAL_FINALIZATION
+    /* Our SMOB free functions are not thread-safe, as GDB itself is not
+       intended to be thread-safe.  Disable automatic finalization so that
+       finalizers aren't run in other threads.  */
+    scm_set_automatic_finalization_enabled (0);
+#endif
+
 #ifdef HAVE_SIGPROCMASK
     /* Before we initialize Guile, block SIGCHLD.
        This is done so that all threads created during Guile initialization
This page took 0.028065 seconds and 4 git commands to generate.