Revert "Reduce sleep duration in SuspendAllDaemonThreads"
run-test 132 randomly chokes due to this change.
Bug: 26351700
This reverts commit adef5bde6c3392dca3dafa0f8d2c9428b59af3ef.
Change-Id: I18e007264e1e8b9027d7d241cb9f0053ad8d112a
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index f9eb935..77f780f 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1158,9 +1158,8 @@
}
// Give the threads a chance to suspend, complaining if they're slow.
bool have_complained = false;
- static constexpr size_t kTimeoutMicroseconds = 200 * 1000;
- static constexpr size_t kSleepMicroseconds = 1000;
- for (size_t i = 0; i < kTimeoutMicroseconds / kSleepMicroseconds; ++i) {
+ for (int i = 0; i < 10; ++i) {
+ usleep(200 * 1000);
bool all_suspended = true;
for (const auto& thread : list_) {
if (thread != self && thread->GetState() == kRunnable) {
@@ -1174,9 +1173,8 @@
if (all_suspended) {
return;
}
- usleep(kSleepMicroseconds);
}
- LOG(ERROR) << "timed out suspending all daemon threads";
+ LOG(ERROR) << "suspend all daemons failed";
}
void ThreadList::Register(Thread* self) {
DCHECK_EQ(self, Thread::Current());