Merge "init: handle process actions when waiting for exec services" am: db8881b769

Change-Id: Ib4cac038b8a95ebbc74c15e2ea25982b6cd6aa1d
This commit is contained in:
Automerger Merge Worker 2020-02-03 14:10:46 +00:00
commit e503a21b0e

View file

@ -780,18 +780,18 @@ int SecondStageMain(int argc, char** argv) {
if (!(waiting_for_prop || Service::is_exec_service_running())) {
am.ExecuteOneCommand();
}
if (!(waiting_for_prop || Service::is_exec_service_running())) {
if (!IsShuttingDown()) {
auto next_process_action_time = HandleProcessActions();
if (!IsShuttingDown()) {
auto next_process_action_time = HandleProcessActions();
// If there's a process that needs restarting, wake up in time for that.
if (next_process_action_time) {
epoll_timeout = std::chrono::ceil<std::chrono::milliseconds>(
*next_process_action_time - boot_clock::now());
if (*epoll_timeout < 0ms) epoll_timeout = 0ms;
}
// If there's a process that needs restarting, wake up in time for that.
if (next_process_action_time) {
epoll_timeout = std::chrono::ceil<std::chrono::milliseconds>(
*next_process_action_time - boot_clock::now());
if (*epoll_timeout < 0ms) epoll_timeout = 0ms;
}
}
if (!(waiting_for_prop || Service::is_exec_service_running())) {
// If there's more work to do, wake up again immediately.
if (am.HasMoreCommands()) epoll_timeout = 0ms;
}