Sleep longer in shutdown with asan
This reduces the probability of an unavoidable race.
Bug: 147804269
Test: Toy experiments with feature tests.
Test: Build with and without asan,
Change-Id: I11d2efa7b2419f56e2e92654c3d5e7effdac1bf7
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 8917560..b2bb846 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1404,6 +1404,12 @@
// Finally wait for any threads woken before we set the "runtime deleted" flags to finish
// touching memory.
usleep(kDaemonSleepTime);
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer) || __has_feature(hwaddress_sanitizer)
+ // Sleep a bit longer with -fsanitize=address, since everything is slower.
+ usleep(2 * kDaemonSleepTime);
+#endif
+#endif
return;
}
usleep(kSleepMicroseconds);