From bc34a7ed232cb3d384c250578e2b4ede45f2b167 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 7 Jan 2016 09:13:24 +0000 Subject: [PATCH] Revert "Reduce sleep duration in SuspendAllDaemonThreads" run-test 132 randomly chokes due to this change. Bug: 26351700 This reverts commit adef5bde6c3392dca3dafa0f8d2c9428b59af3ef. Change-Id: I18e007264e1e8b9027d7d241cb9f0053ad8d112a --- runtime/thread_list.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index f9eb9359c..77f780fe1 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -1158,9 +1158,8 @@ void ThreadList::SuspendAllDaemonThreads() { } // 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 @@ void ThreadList::SuspendAllDaemonThreads() { 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()); -- 2.11.0