Fix gctest failure if compiled with TSan and parallel marker
authorIvan Maidanski <ivmai@mail.ru>
Tue, 12 Dec 2017 16:24:02 +0000 (19:24 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 12 Dec 2017 16:24:02 +0000 (19:24 +0300)
As of clang-4.0, Thread Sanitizer does not support creation of threads
in the forked process (before exec).  So, GC_start_mark_threads()
is a no-op now if TSan is enabled.

* misc.c [THREADS && PARALLEL_MARK && CAN_HANDLE_FORK]
(GC_start_mark_threads): Do not call GC_start_mark_threads_inner()
if THREAD_SANITIZER; add comment.

misc.c

diff --git a/misc.c b/misc.c
index e28fbff..0c40e9b 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1343,7 +1343,9 @@ GC_API void GC_CALL GC_enable_incremental(void)
 #if defined(THREADS)
   GC_API void GC_CALL GC_start_mark_threads(void)
   {
-#   if defined(PARALLEL_MARK) && defined(CAN_HANDLE_FORK)
+#   if defined(PARALLEL_MARK) && defined(CAN_HANDLE_FORK) \
+       && !defined(THREAD_SANITIZER)
+      /* TSan does not support threads creation in the child process.   */
       IF_CANCEL(int cancel_state;)
 
       DISABLE_CANCEL(cancel_state);