mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
allow gc <= 7.1 to stop the signal delivery thread
* configure.ac: Add a check for GC_get_suspend_signal(). * libguile/scmsigs.c (GC_get_suspend_signal): Define a fallback implementation if one isn't available. (signal_delivery_thread): Unmask the suspend signal so that GC can stop the world. Fixes test-pthread-create on libgc 7.1 and earlier. Thanks to Frank Terbeck <ft@bewatermyfriend.org> for the report.
This commit is contained in:
parent
78f0ef20a7
commit
43adb591f4
2 changed files with 26 additions and 1 deletions
|
@ -1311,7 +1311,7 @@ save_LIBS="$LIBS"
|
|||
LIBS="$BDW_GC_LIBS $LIBS"
|
||||
CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
|
||||
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback])
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_suspend_signal])
|
||||
|
||||
# Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
|
||||
# declared, and has a different type (returning void instead of
|
||||
|
|
|
@ -150,6 +150,26 @@ struct signal_pipe_data
|
|||
int err;
|
||||
};
|
||||
|
||||
#ifndef HAVE_GC_GET_SUSPEND_SIGNAL
|
||||
static int
|
||||
GC_get_suspend_signal (void)
|
||||
{
|
||||
#if defined SIG_SUSPEND
|
||||
return SIG_SUSPEND;
|
||||
#elif defined SIGPWR
|
||||
return SIGPWR;
|
||||
#elif defined SIGLOST
|
||||
return SIGLOST;
|
||||
#elif defined _SIGRTMIN
|
||||
return _SIGRTMIN + 6;
|
||||
#elif defined SIGRTMIN
|
||||
return SIGRTMIN + 6;
|
||||
#else
|
||||
#error what suspend signal to use?
|
||||
#endif
|
||||
}
|
||||
#endif /* HAVE_GC_GET_SUSPEND_SIGNAL */
|
||||
|
||||
static void*
|
||||
read_signal_pipe_data (void * data)
|
||||
{
|
||||
|
@ -168,6 +188,11 @@ signal_delivery_thread (void *data)
|
|||
#if HAVE_PTHREAD_SIGMASK /* not on mingw, see notes above */
|
||||
sigset_t all_sigs;
|
||||
sigfillset (&all_sigs);
|
||||
/* On libgc 7.1 and earlier, GC_do_blocking doesn't actually do
|
||||
anything. So in that case, libgc will want to suspend the signal
|
||||
delivery thread, so we need to allow it to do so by unmasking the
|
||||
suspend signal. */
|
||||
sigdelset (&all_sigs, GC_get_suspend_signal ());
|
||||
scm_i_pthread_sigmask (SIG_SETMASK, &all_sigs, NULL);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue