Merge "init: don't wait if we have more work to do" am: 32ee9fc24a am: c746ecbcbe
am: df47019a30
Change-Id: I5b3b6e2dd9c3696fad262711290e484f4298205b
diff --git a/init/init.cpp b/init/init.cpp
index 371186b..ef6f37c 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -731,15 +731,15 @@
// By default, sleep until something happens.
int epoll_timeout_ms = -1;
- // If there's more work to do, wake up again immediately.
- if (am.HasMoreCommands()) epoll_timeout_ms = 0;
-
// If there's a process that needs restarting, wake up in time for that.
if (process_needs_restart_at != 0) {
epoll_timeout_ms = (process_needs_restart_at - time(nullptr)) * 1000;
if (epoll_timeout_ms < 0) epoll_timeout_ms = 0;
}
+ // If there's more work to do, wake up again immediately.
+ if (am.HasMoreCommands()) epoll_timeout_ms = 0;
+
bootchart_sample(&epoll_timeout_ms);
epoll_event ev;