]> granicus.if.org Git - gc/commitdiff
Add config option to use STGRTMIN-based signals for thread suspend/resume
authorDavid Grove <groved@us.ibm.com>
Wed, 8 Jan 2014 23:18:16 +0000 (18:18 -0500)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 2 May 2014 20:17:16 +0000 (00:17 +0400)
Change motivated by using BDWGC in the X10 runtime on systems where
IBM Parallel Environment is used to launch the X10 processes. PE
is already using the signals BDWCG is using for its own purposes, so
we need to force the GC to use different ones to avoid a conflict.

* configure.ac (sigrt-signals): Handle new option.
* configure.ac (GC_USESIGRT_SIGNALS): New AC define.
* include/private/gc_priv.h (SIG_SUSPEND): Force to be defined to
_SIGRTMIN+6 if GC_USESIGRT_SIGNALS (Darwin is excluded anyway).
* pthread_stop_world.c (SIG_THR_RESTART): Force to be defined to
_SIGRTMIN+5 if GC_USESIGRT_SIGNALS; reformat code.

configure.ac
include/private/gc_priv.h
pthread_stop_world.c

index 2251d65b095b6a0b53f6bcdeaca9ef2f624732e8..2d0c9f407ec7f0094e2d97d43a6592547b88318b 100644 (file)
@@ -668,6 +668,16 @@ if test x"$enable_gcj_support" != xno; then
     AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj.])
 fi
 
+dnl Interaction with other programs that might use signals.
+AC_ARG_ENABLE(sigrt-signals,
+    [AC_HELP_STRING([--enable-sigrt-signals],
+        [Force GC to use SIGRTMIN-based signals for thread suspend/resume])])
+if test x"${enable_sigrt_signals}" = xyes; then
+    AC_DEFINE([GC_USESIGRT_SIGNALS], 1,
+              [Force the GC to use signals based on SIGRTMIN+k.])
+fi
+
+
 dnl Debugging
 dnl ---------
 
index f80cd94ed733b85e859f5d14bfc5b1c7987eca91..47f48d9118a36fd459bb35d74b50fa67c7072035 100644 (file)
@@ -2375,14 +2375,15 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
 #endif /* PARALLEL_MARK */
 
 #if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && !defined(NACL) \
-    && !defined(SIG_SUSPEND)
+    && !defined(GC_DARWIN_THREADS) && !defined(SIG_SUSPEND)
   /* We define the thread suspension signal here, so that we can refer  */
   /* to it in the dirty bit implementation, if necessary.  Ideally we   */
   /* would allocate a (real-time?) signal using the standard mechanism. */
   /* unfortunately, there is no standard mechanism.  (There is one      */
   /* in Linux glibc, but it's not exported.)  Thus we continue to use   */
   /* the same hard-coded signals we've always used.                     */
-# if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS)
+# if (defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS)) \
+     && !defined(GC_USESIGRT_SIGNALS)
 #   if defined(SPARC) && !defined(SIGPWR)
       /* SPARC/Linux doesn't properly define SIGPWR in <signal.h>.      */
       /* It is aliased to SIGLOST in asm/signal.h, though.              */
@@ -2395,12 +2396,10 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
 #   ifndef GC_OPENBSD_UTHREADS
 #     define SIG_SUSPEND SIGXFSZ
 #   endif
-# elif !defined(GC_DARWIN_THREADS)
-#   if defined(_SIGRTMIN)
-#     define SIG_SUSPEND _SIGRTMIN + 6
-#   else
-#     define SIG_SUSPEND SIGRTMIN + 6
-#   endif
+# elif defined(_SIGRTMIN)
+#   define SIG_SUSPEND _SIGRTMIN + 6
+# else
+#   define SIG_SUSPEND SIGRTMIN + 6
 # endif
 #endif /* GC_PTHREADS && !SIG_SUSPEND */
 
index e3726cd3832a0199860ee46e80126edb5325fa5e..d2a26d245a55074ba604028636a7c7a37afdac16 100644 (file)
@@ -129,18 +129,17 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE;
  * Note that we can't just stop a thread; we need it to save its stack
  * pointer(s) and acknowledge.
  */
-
 #ifndef SIG_THR_RESTART
-#  if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \
-      || defined(GC_NETBSD_THREADS)
-#    ifdef _SIGRTMIN
-#      define SIG_THR_RESTART _SIGRTMIN + 5
-#    else
-#      define SIG_THR_RESTART SIGRTMIN + 5
-#    endif
-#  else
+# if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \
+     || defined(GC_NETBSD_THREADS) || defined(GC_USESIGRT_SIGNALS)
+#   ifdef _SIGRTMIN
+#     define SIG_THR_RESTART _SIGRTMIN + 5
+#   else
+#     define SIG_THR_RESTART SIGRTMIN + 5
+#   endif
+# else
 #   define SIG_THR_RESTART SIGXCPU
-#  endif
+# endif
 #endif
 
 STATIC int GC_sig_suspend = SIG_SUSPEND;