Increase shutdown time constants
Wait longer before and after setting runtime deleted flag. This gives
daemons a longer time to reach an idle state, and
2033-shutdown-mechanics a better opportunity to observe changes during
the shutdown process. Slows down "normal" shutdowns with running user
daemons. That shouldn't normally occur in production and is rare during
testing.
In 2033-shutdown-mechanics, wait longer to make sure the child thread
is ready and waiting when we shut down.
Test: Ran 2033-shutdown-mechanics a few times.
Change-Id: I2b5b420cf8dfc37fa154c4624bcdc66acb78258d
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 5d1dd55..acc5f17 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1222,7 +1222,7 @@
}
// Assume all threads are either suspended or somehow wedged.
// Wait again for all the now "suspended" threads to actually quiesce. (b)
- static constexpr size_t kDaemonSleepTime = 200 * 1000;
+ static constexpr size_t kDaemonSleepTime = 400'000;
usleep(kDaemonSleepTime);
std::list<Thread*> list_copy;
{
diff --git a/test/2033-shutdown-mechanics/src/Main.java b/test/2033-shutdown-mechanics/src/Main.java
index 106143c..33548bd 100644
--- a/test/2033-shutdown-mechanics/src/Main.java
+++ b/test/2033-shutdown-mechanics/src/Main.java
@@ -34,7 +34,7 @@
t.setDaemon(true);
t.start();
try {
- Thread.sleep(200);
+ Thread.sleep(400);
} catch (InterruptedException e) {
System.out.println("Unexpected interrupt");
}