From: Ivan Maidanski Date: Mon, 2 Apr 2018 23:21:00 +0000 (+0300) Subject: Replace GC_NO_RETRY_SIGNALS environment variable with GC_RETRY_SIGNALS=0 X-Git-Tag: v8.0.0~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e07dc277ddbd788230c7ef2acfdd3e3ed7f15aad;p=gc Replace GC_NO_RETRY_SIGNALS environment variable with GC_RETRY_SIGNALS=0 * doc/README.environment (GC_NO_RETRY_SIGNALS): Remove. * doc/README.environment (GC_RETRY_SIGNALS): Document "0" value. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_init): Declare str local variable; do not check GC_NO_RETRY_SIGNALS environment variable; refine comment; set GC_retry_signals to false if the value of GC_RETRY_SIGNALS environment variable is "0". --- diff --git a/doc/README.environment b/doc/README.environment index b35eb894..c977388a 100644 --- a/doc/README.environment +++ b/doc/README.environment @@ -96,13 +96,13 @@ GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects of Conservative Garbage Collectors", POPL 2001 (http://www.hpl.hp.com/techreports/2001/HPL-2001-251.html). -GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS - Try to compensate for lost +GC_RETRY_SIGNALS - Try to compensate for lost thread suspend and restart signals (Pthreads only). On by default for OSF1 (Tru64) or if the library is sanitized, off otherwise. Since we've previously seen similar issues on some other operating systems, it was turned into a runtime flag to enable last-minute - work-arounds. + work-arounds. "0" value means "do not retry signals". GC_USE_GETWRITEWATCH= - Only if MPROTECT_VDB and GWW_VDB are both defined (Win32 only). Explicitly specify which strategy of diff --git a/pthread_stop_world.c b/pthread_stop_world.c index b81274f2..b4c6a711 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -1140,6 +1140,7 @@ GC_INNER void GC_stop_init(void) { # if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL) struct sigaction act; + char *str; if (SIGNAL_UNSET == GC_sig_suspend) GC_sig_suspend = SIG_SUSPEND; @@ -1195,12 +1196,15 @@ GC_INNER void GC_stop_init(void) if (sigdelset(&suspend_handler_mask, GC_sig_thr_restart) != 0) ABORT("sigdelset failed"); - /* Check for GC_RETRY_SIGNALS. */ - if (0 != GETENV("GC_RETRY_SIGNALS")) { - GC_retry_signals = TRUE; - } - if (0 != GETENV("GC_NO_RETRY_SIGNALS")) { - GC_retry_signals = FALSE; + /* Override the default value of GC_retry_signals. */ + str = GETENV("GC_RETRY_SIGNALS"); + if (str != NULL) { + if (*str == '0' && *(str + 1) == '\0') { + /* Do not retry if the environment variable is set to "0". */ + GC_retry_signals = FALSE; + } else { + GC_retry_signals = TRUE; + } } if (GC_retry_signals) { GC_COND_LOG_PRINTF(