Hi,
Alle mercoledì 16 novembre 2011, Svante Signell ha scritto:
> The attached patch fixes the FTBFS problems of ecl on GNU/Hurd. When
> native threads are enabled the "./ecl_min compile" command hangs.
Preface: libgc, used by ecl, makes use of the SIGUSR1 & SIGUSR2 signals
(handling them on its own) to respectively suspend and & threads when
the main thread needs to "stop the world" and garbage collect or so.
In ecl, src/c/unixint.d, there is the following function:
| static void
| install_process_interrupt_handler()
| {
| #ifdef SIGRTMIN
| # define DEFAULT_THREAD_INTERRUPT_SIGNAL SIGRTMIN + 2
| #else
| # define DEFAULT_THREAD_INTERRUPT_SIGNAL SIGUSR1
| #endif
| #if defined(ECL_THREADS) && !defined(ECL_MS_WINDOWS_HOST)
| if (ecl_get_option(ECL_OPT_TRAP_INTERRUPT_SIGNAL)) {
| int signal = ecl_get_option(ECL_OPT_THREAD_INTERRUPT_SIGNAL);
| if (signal == 0) {
| signal = DEFAULT_THREAD_INTERRUPT_SIGNAL;
| ecl_set_option(ECL_OPT_THREAD_INTERRUPT_SIGNAL,
| signal);
| }
| mysignal(signal, non_evil_signal_handler);
| #ifdef HAVE_SIGROCMASK
| sigdelset(cl_core.default_sigmask, signal);
| pthread_sigmask(SIG_SETMASK, cl_core.default_sigmask, NULL);
| #endif
| }
| #endif
| }
given on Hurd we don't have realtime signals yet, SIGRTMIN (and
SIGRTMAX) is not defined, which makes SIGUSR1 the signal being used for
the inter-thread communication, overriding the SIGUSR1 handler set by
libgc.
The solution (a bit of hack, actually) I have is use a different signal
for DEFAULT_THREAD_INTERRUPT_SIGNAL (I chose SIGINFO, generally not used
and not POSIX); this allowed me to compile ecl correctly.
I attached the patch for it; note I don't think it should be forwarded
upstream, as it is not clean and kind of working around the lack of
realtime signals in Hurd.
--
Pino Toscano
--- a/src/c/unixint.d
+++ b/src/c/unixint.d
@@ -1073,6 +1073,8 @@
{
#ifdef SIGRTMIN
# define DEFAULT_THREAD_INTERRUPT_SIGNAL SIGRTMIN + 2
+#elif defined(__GNU__)
+# define DEFAULT_THREAD_INTERRUPT_SIGNAL SIGINFO
#else
# define DEFAULT_THREAD_INTERRUPT_SIGNAL SIGUSR1
#endif
Attachment:
signature.asc
Description: This is a digitally signed message part.