]> granicus.if.org Git - gc/commitdiff
Fix gcconfig to turn on POSIX fork() support by default
authorAndy Wingo <wingo@pobox.com>
Mon, 20 Feb 2012 17:51:21 +0000 (21:51 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 21 Feb 2012 17:34:42 +0000 (21:34 +0400)
(define HANDLE_FORK on Unix platforms with pthreads)

* doc/README.macros (HANDLE_FORK): Replace with NO_HANDLE_FORK; update
the documentation.
* include/private/gcconfig.h (HANDLE_FORK): Explicitly define if
GC_PTHREADS unless already defined or NO_HANDLE_FORK is defined, or
unsupported on the target.

doc/README.macros
include/private/gcconfig.h

index a6291bafe9b28c4b8b1107dd38a7ccfd67598b08..c745eb35c92dd7e21de94d77ef58e684162d7836 100644 (file)
@@ -433,9 +433,9 @@ STUBBORN_ALLOC  Allows allocation of "hard to change" objects, and thus
   makes incremental collection easier.  Was enabled by default until 6.0.
   Rarely used, to my knowledge.
 
-HANDLE_FORK     Attempts to make GC_malloc() work in a child process fork()'ed
-  from a multithreaded parent.  Currently only supported by pthread_support.c.
-  (Similar code should work on Solaris or Irix, but it hasn't been tried.)
+NO_HANDLE_FORK (Unix only)      Do not attempt to make GC_malloc() work in
+  a child process fork()'ed from a multi-threaded parent.  (Might be required
+  if pthread_atfork is missing.)
 
 TEST_WITH_SYSTEM_MALLOC         Causes gctest to allocate (and leak) large
   chunks of memory with the standard system malloc.  This will cause the root
index 310afdff041bdbf2ec3d8c1f91f5ed010a57c700..3ab71560bec7fbdb4cd52595d1ffadcdb6872b2a 100644 (file)
 # define IF_CANCEL(x) /* empty */
 #endif
 
+#if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) \
+    && !defined(HANDLE_FORK) && !defined(NO_HANDLE_FORK) \
+    && !defined(HURD) && !defined(NACL) && !defined(PLATFORM_ANDROID)
+  /* Attempts (where supported) to make GC_malloc work in a child       */
+  /* process fork'ed from a multi-threaded parent.                      */
+# define HANDLE_FORK
+#endif
+
 #if !defined(USE_MARK_BITS) && !defined(USE_MARK_BYTES) \
     && defined(PARALLEL_MARK)
    /* Minimize compare-and-swap usage.  */