[guile] Run finalizers from GDB thread

gdb/ChangeLog:

	* guile/guile.c (_initialize_guile): Disable automatic
	finalization, if Guile offers us that possibility.
	* guile/guile.c (call_initialize_gdb_module):
	* guile/scm-safe-call.c (gdbscm_with_catch): Arrange to run
	finalizers in appropriate places.
	* config.in (HAVE_GUILE_MANUAL_FINALIZATION): New definition.
	* configure.ac (AC_TRY_LIBGUILE): Add a check for
	scm_set_automatic_finalization_enabled.
	* configure: Regenerated.
This commit is contained in:
Andy Wingo
2015-03-11 13:07:53 +01:00
parent e03f96456f
commit 92fab5a617
6 changed files with 66 additions and 0 deletions

View 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