]> granicus.if.org Git - gc/commitdiff
Remove 'sig' argument of GC_suspend_handler_inner
authorIvan Maidanski <ivmai@mail.ru>
Thu, 19 Nov 2015 22:22:39 +0000 (01:22 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 19 Nov 2015 22:22:39 +0000 (01:22 +0300)
(Code refactoring)

* pthread_stop_world.c (GC_suspend_handler_inner): Rename "sig_arg"
argument to "dummy"; mark it as GC_ATTR_UNUSED.
* pthread_stop_world.c (GC_suspend_handler): Pass NULL instead of sig
to GC_suspend_handler_inner.
* pthread_stop_world.c (GC_suspend_handler): Move sig check from
GC_suspend_handler_inner.

pthread_stop_world.c

index 223930920c7929e29bec735867a3406dd0a15e2a..63c93c0f2246ba4182503166fa938f23c9435daa 100644 (file)
@@ -200,7 +200,7 @@ STATIC sem_t GC_suspend_ack_sem;
   STATIC sem_t GC_restart_ack_sem;
 #endif
 
-STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
+STATIC void GC_suspend_handler_inner(ptr_t dummy, void *context);
 
 #ifndef NO_SA_SIGACTION
   STATIC void GC_suspend_handler(int sig, siginfo_t * info GC_ATTR_UNUSED,
@@ -211,20 +211,30 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
 {
   int old_errno = errno;
 
+  if (sig != GC_sig_suspend) {
+#   if defined(GC_FREEBSD_THREADS)
+      /* Workaround "deferred signal handling" bug in FreeBSD 9.2.      */
+      if (0 == sig) return;
+#   endif
+    ABORT("Bad signal in suspend_handler");
+  }
+
 # if defined(IA64) || defined(HP_PA) || defined(M68K)
-    GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
+    GC_with_callee_saves_pushed(GC_suspend_handler_inner, NULL);
 # else
     /* We believe that in all other cases the full context is already   */
     /* in the signal handler frame.                                     */
-#   ifdef NO_SA_SIGACTION
-      void *context = 0;
-#   endif
-    GC_suspend_handler_inner((ptr_t)(word)sig, context);
+    {
+#     ifdef NO_SA_SIGACTION
+        void *context = 0;
+#     endif
+      GC_suspend_handler_inner(NULL, context);
+    }
 # endif
   errno = old_errno;
 }
 
-STATIC void GC_suspend_handler_inner(ptr_t sig_arg,
+STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED,
                                      void * context GC_ATTR_UNUSED)
 {
   pthread_t self = pthread_self();
@@ -232,14 +242,6 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg,
   IF_CANCEL(int cancel_state;)
   AO_t my_stop_count = AO_load(&GC_stop_count);
 
-  if ((signed_word)sig_arg != GC_sig_suspend) {
-#   if defined(GC_FREEBSD_THREADS)
-      /* Workaround "deferred signal handling" bug in FreeBSD 9.2.      */
-      if (0 == sig_arg) return;
-#   endif
-    ABORT("Bad signal in suspend_handler");
-  }
-
   DISABLE_CANCEL(cancel_state);
       /* pthread_setcancelstate is not defined to be async-signal-safe. */
       /* But the glibc version appears to be in the absence of          */