]> granicus.if.org Git - gc/commitdiff
Fix GC_dirty_init by avoiding GC_get_suspend_signal if no threads support
authorIvan Maidanski <ivmai@mail.ru>
Tue, 24 Jul 2012 06:34:15 +0000 (10:34 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 24 Jul 2012 07:36:50 +0000 (11:36 +0400)
(fix commit '05daaee')

* os_dep.c (GC_dirty_init): Pass SIG_SUSPEND instead of
GC_get_suspend_signal() to sigaddset() if no THREADS (or if
GC_OPENBSD_THREADS, or GC_WIN32_THREADS or NACL).
* pthread_support.c (pthread_sigmask): Assert GC_get_suspend_signal()
does not return -1 (only if not GC_NO_PTHREAD_SIGMASK).

os_dep.c
pthread_support.c

index 84ea1ca6013e3fca5e76449f9d18a9177e5f4e0e..a178c2e24cbc631fa25585c715b43438346c5cdd 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3317,7 +3317,12 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks,
         /* 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.                                   */
-        (void)sigaddset(&act.sa_mask, GC_get_suspend_signal());
+#       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
 #     endif
 #   endif
     if (GC_print_stats == VERBOSE)
index 4dad56ff44c9a9bb6746ef8391c3159b77d21d13..acd4b664bfbda0d7515e3f62588d1c2bec80d4ec 100644 (file)
@@ -1140,11 +1140,14 @@ GC_INNER void GC_init_parallel(void)
                                         sigset_t *oset)
   {
     sigset_t fudged_set;
+    int sig_suspend;
 
     INIT_REAL_SYMS();
     if (set != NULL && (how == SIG_BLOCK || how == SIG_SETMASK)) {
         fudged_set = *set;
-        sigdelset(&fudged_set, GC_get_suspend_signal());
+        sig_suspend = GC_get_suspend_signal();
+        GC_ASSERT(sig_suspend >= 0);
+        sigdelset(&fudged_set, sig_suspend);
         set = &fudged_set;
     }
     return(REAL_FUNC(pthread_sigmask)(how, set, oset));