summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/README.macros6
-rw-r--r--include/private/gcconfig.h8
2 files changed, 11 insertions, 3 deletions
diff --git a/doc/README.macros b/doc/README.macros
index 1136f3aa..659e958c 100644
--- a/doc/README.macros
+++ b/doc/README.macros
@@ -435,9 +435,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
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index d9c1d637..a2ba20d3 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -2612,6 +2612,14 @@
# 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. */