]> granicus.if.org Git - gc/commitdiff
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 e28fbfff0e6cc4fade46e364bf2ba4887f51101e..0c40e9baa1462779db29c6a86cf0b84cea129d0c 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);