From 37d8fb73e7210509bdc5f3e69b1ec5f8dcc6bda0 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 22 Nov 2012 08:39:20 +0400 Subject: [PATCH] Prevent POSIX fork if mprotect_thread is started (Darwin) * pthread_support.c (GC_atfork_prepare): Abort if GC_dirty_maintained is set for Darwin (only if MPROTECT_VDB) since graceful suspend/resume of mprotect_thread is unsupported at present. --- pthread_support.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pthread_support.c b/pthread_support.c index f270b59..c65ecfa 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -996,6 +996,12 @@ static void fork_child_proc(void) /* Routines for fork handling by client (no-op if pthread_atfork works). */ GC_API void GC_CALL GC_atfork_prepare(void) { +# if defined(GC_DARWIN_THREADS) && defined(MPROTECT_VDB) + if (GC_dirty_maintained) { + GC_ASSERT(0 == GC_handle_fork); + ABORT("Unable to fork while mprotect_thread is running"); + } +# endif if (GC_handle_fork <= 0) fork_prepare_proc(); } -- 2.7.4