tsan: add support for idle threads



git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177292 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/tsan/rtl/tsan_mman.cc b/lib/tsan/rtl/tsan_mman.cc
index 1d887c6..7c7b89c 100644
--- a/lib/tsan/rtl/tsan_mman.cc
+++ b/lib/tsan/rtl/tsan_mman.cc
@@ -234,4 +234,9 @@
   MBlock *b = (MBlock*)allocator()->GetMetaData(p);
   return b->size;
 }
+
+void __tsan_on_thread_idle() {
+  ThreadState *thr = cur_thread();
+  allocator()->SwallowCache(&thr->alloc_cache);
+}
 }  // extern "C"