]> granicus.if.org Git - gc/commitdiff
Replace GC_NO_RETRY_SIGNALS environment variable with GC_RETRY_SIGNALS=0
authorIvan Maidanski <ivmai@mail.ru>
Mon, 2 Apr 2018 23:21:00 +0000 (02:21 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 2 Apr 2018 23:23:48 +0000 (02:23 +0300)
* 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".

doc/README.environment
pthread_stop_world.c

index b35eb8944bfd15b53a997db60a6d8ac4bcd44e99..c977388aa13692085bd8bf2edd660e121a1fe0e6 100644 (file)
@@ -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=<n> - Only if MPROTECT_VDB and GWW_VDB are both defined
                      (Win32 only).  Explicitly specify which strategy of
index b81274f2347f4ef05b23b7607a99aeb6c79507e8..b4c6a711806fd7cdc6439245a2dd37e3fa290e08 100644 (file)
@@ -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(