From: Ivan Maidanski Date: Tue, 24 Jul 2012 09:23:12 +0000 (+0400) Subject: Postpone the suspend signal in GC_dirty_init only if used to stop world X-Git-Tag: gc7_4_0~244 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=977e8a0187f9961e843a6662022f05396aa33374;p=gc Postpone the suspend signal in GC_dirty_init only if used to stop world * os_dep.c (GC_dirty_init): Do not call sigaddset(SIG_SUSPEND) if no THREADS or if SIG_SUSPEND is unused for suspending threads. --- diff --git a/os_dep.c b/os_dep.c index a178c2e2..b9343053 100644 --- 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");