]> granicus.if.org Git - gc/commitdiff
Postpone the suspend signal in GC_dirty_init only if used to stop world
authorIvan Maidanski <ivmai@mail.ru>
Tue, 24 Jul 2012 09:23:12 +0000 (13:23 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 24 Jul 2012 09:25:34 +0000 (13:25 +0400)
* os_dep.c (GC_dirty_init): Do not call sigaddset(SIG_SUSPEND) if
no THREADS or if SIG_SUSPEND is unused for suspending threads.

os_dep.c

index a178c2e24cbc631fa25585c715b43438346c5cdd..b9343053da8ac3415f252c772882f2b9d1826f35 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3309,22 +3309,18 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks,
   GC_INNER void GC_dirty_init(void)
   {
 #   if !defined(MSWIN32) && !defined(MSWINCE)
-      struct sigaction  act, oldact;
-      act.sa_flags      = SA_RESTART | SA_SIGINFO;
+      struct sigaction act, oldact;
+      act.sa_flags = SA_RESTART | SA_SIGINFO;
       act.sa_sigaction = GC_write_fault_handler;
       (void)sigemptyset(&act.sa_mask);
-#     ifdef SIG_SUSPEND
+#     if defined(THREADS) && !defined(GC_OPENBSD_THREADS) \
+         && !defined(GC_WIN32_THREADS) && !defined(NACL)
         /* Arrange to postpone the signal while we are in a write fault */
         /* handler.  This effectively makes the handler atomic w.r.t.   */
         /* stopping the world for GC.                                   */
-#       if defined(THREADS) && !defined(GC_OPENBSD_THREADS) \
-           && !defined(GC_WIN32_THREADS) && !defined(NACL)
-          (void)sigaddset(&act.sa_mask, GC_get_suspend_signal());
-#       else
-          (void)sigaddset(&act.sa_mask, SIG_SUSPEND);
-#       endif
+        (void)sigaddset(&act.sa_mask, GC_get_suspend_signal());
 #     endif
-#   endif
+#   endif /* !MSWIN32 */
     if (GC_print_stats == VERBOSE)
       GC_log_printf(
                 "Initializing mprotect virtual dirty bit implementation\n");