]> granicus.if.org Git - gc/commitdiff
Move GC_get_suspend/thr_restart_signal to misc.c for NaCl and OpenBSD
authorIvan Maidanski <ivmai@mail.ru>
Wed, 4 Jul 2012 15:59:34 +0000 (19:59 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 4 Jul 2012 15:59:34 +0000 (19:59 +0400)
* misc.c (GC_get_suspend_signal, GC_get_thr_restart_signal): Define
also for OpenBSD and NaCl targets in this file (always returns -1).
* pthread_stop_world.c (GC_get_suspend_signal,
GC_get_thr_restart_signal): Move function definition up to the
definition of GC_sig_suspend and GC_sig_thr_restart variables (i.e.,
define function only if not OpenBSD and not NaCl target in this file).

misc.c
pthread_stop_world.c

diff --git a/misc.c b/misc.c
index 702039784ab60a6367580b033145e5a06b8fad56..e3c3478c4be1def838fd100dca7dc56a96b91721 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -507,17 +507,19 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size,
   UNLOCK();
 }
 
-#if defined(GC_DARWIN_THREADS) || defined(GC_WIN32_THREADS)
+#if defined(GC_DARWIN_THREADS) || defined(GC_OPENBSD_THREADS) \
+    || defined(GC_WIN32_THREADS) || (defined(NACL) && defined(THREADS))
+  /* GC does not use signals to suspend and restart threads.    */
   GC_API int GC_CALL GC_get_suspend_signal(void)
   {
-    return -1; /* GC does not use signals to suspend threads. */
+    return -1;
   }
 
   GC_API int GC_CALL GC_get_thr_restart_signal(void)
   {
-    return -1; /* GC does not use signals to restart threads. */
+    return -1;
   }
-#endif /* GC_DARWIN_THREADS || GC_WIN32_THREADS */
+#endif /* GC_DARWIN_THREADS || GC_WIN32_THREADS || ... */
 
 #if !defined(_MAX_PATH) && (defined(MSWIN32) || defined(MSWINCE) \
                             || defined(CYGWIN32))
index 316ab4d1f0d5f2993cc1676dde02634b851c169e..74500c4b3b4a164cae7a29071205748f68e2fdbb 100644 (file)
@@ -144,6 +144,16 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE;
 STATIC int GC_sig_suspend = SIG_SUSPEND;
 STATIC int GC_sig_thr_restart = SIG_THR_RESTART;
 
+GC_API int GC_CALL GC_get_suspend_signal(void)
+{
+  return GC_sig_suspend;
+}
+
+GC_API int GC_CALL GC_get_thr_restart_signal(void)
+{
+  return GC_sig_thr_restart;
+}
+
 #ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
   /* Some targets (eg., Solaris) might require this to be called when   */
   /* doing thread registering from the thread destructor.               */
@@ -892,22 +902,4 @@ GC_INNER void GC_stop_init(void)
 # endif /* !GC_OPENBSD_THREADS && !NACL */
 }
 
-GC_API int GC_CALL GC_get_suspend_signal(void)
-{
-# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
-    return GC_sig_suspend;
-# else
-    return -1;
-# endif
-}
-
-GC_API int GC_CALL GC_get_thr_restart_signal(void)
-{
-# if !defined(GC_OPENBSD_THREADS) && !defined(NACL)
-    return GC_sig_thr_restart;
-# else
-    return -1;
-# endif
-}
-
 #endif /* GC_PTHREADS && !GC_DARWIN_THREADS && !GC_WIN32_THREADS */