diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-03-30 20:41:41 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-03-30 20:41:41 +0300 |
commit | 5bf02fe0f63a73ea16e53803977fbef08941c170 (patch) | |
tree | 677c8033f79dcb6048e9e98bdd95e89b97c319e6 /pthread_stop_world.c | |
parent | 5e6cc59b0a9d8c3175802809549f79bf1cbc4282 (diff) | |
download | bdwgc-5bf02fe0f63a73ea16e53803977fbef08941c170.tar.gz |
Unblock only GC signals in suspend_handler (TSan)
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.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r-- | pthread_stop_world.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 79602e0e..bd67c5f3 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -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 */ |