]> granicus.if.org Git - gc/commitdiff
Unblock only GC signals in suspend_handler (TSan)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 30 Mar 2018 17:41:41 +0000 (20:41 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 30 Mar 2018 17:41:41 +0000 (20:41 +0300)
Issue #181 (bdwgc).

* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL
&& THREAD_SANITIZER] (GC_suspend_handler_inner): Replace
pthread_sigmask(SIG_SETMASK) to pthread_sigmask(SIG_UNBLOCK) with the
set with GC_sig_suspend and GC_sig_thr_restart signals.

pthread_stop_world.c

index 79602e0eb7c3f4b1bcda80d8557ae3790aa5585c..bd67c5f3a2af277c62f7cd2515737b62c67266a4 100644 (file)
@@ -334,8 +334,12 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED,
     {
       sigset_t set;
       sigemptyset(&set);
-      if (pthread_sigmask(SIG_SETMASK, &set, NULL) != 0)
-        ABORT("pthread_sigmask(SIG_SETMASK) failed");
+      GC_ASSERT(GC_sig_suspend != SIGNAL_UNSET);
+      GC_ASSERT(GC_sig_thr_restart != SIGNAL_UNSET);
+      sigaddset(&set, GC_sig_suspend);
+      sigaddset(&set, GC_sig_thr_restart);
+      if (pthread_sigmask(SIG_UNBLOCK, &set, NULL) != 0)
+        ABORT("pthread_sigmask failed in suspend handler");
     }
 # endif
   /* Tell the thread that wants to stop the world that this     */