Merge "init: don't wait if we have more work to do"

am: 32ee9fc24a

Change-Id: Ie260a9e3d491b9108dc7681ede5a0e3ceac9ef79
This commit is contained in:
Wei Wang 2016-12-01 03:51:19 +00:00 committed by android-build-merger
commit c746ecbcbe

View file

@ -731,15 +731,15 @@ int main(int argc, char** argv) {
// By default, sleep until something happens. // By default, sleep until something happens.
int epoll_timeout_ms = -1; 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 there's a process that needs restarting, wake up in time for that.
if (process_needs_restart_at != 0) { if (process_needs_restart_at != 0) {
epoll_timeout_ms = (process_needs_restart_at - time(nullptr)) * 1000; epoll_timeout_ms = (process_needs_restart_at - time(nullptr)) * 1000;
if (epoll_timeout_ms < 0) epoll_timeout_ms = 0; 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); bootchart_sample(&epoll_timeout_ms);
epoll_event ev; epoll_event ev;