diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-02-03 20:45:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-02-03 20:45:59 +0000 |
commit | 564aeca94e18cd708f93619551e05b3d59d4abe2 (patch) | |
tree | 69e5717d8a8a4ad3ece04191bce25fed43492c58 /init/init.cpp | |
parent | 01b25ab14912712024d5342064c7b70de85e2db8 (diff) | |
parent | 2d0fdaaafc5d2925b8ef7708a950f6b599892b54 (diff) |
Merge "init: clean up exec command"
Diffstat (limited to 'init/init.cpp')
-rw-r--r-- | init/init.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/init/init.cpp b/init/init.cpp index c8c18d2f3..43f601f69 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -82,7 +82,7 @@ static time_t process_needs_restart_at; const char *ENV[32]; -bool waiting_for_exec = false; +static std::unique_ptr<Timer> waiting_for_exec(nullptr); static int epoll_fd = -1; @@ -131,7 +131,24 @@ int add_environment(const char *key, const char *val) return -1; } -bool wait_property(const char *name, const char *value) +bool start_waiting_for_exec() +{ + if (waiting_for_exec) { + return false; + } + waiting_for_exec.reset(new Timer()); + return true; +} + +void stop_waiting_for_exec() +{ + if (waiting_for_exec) { + LOG(INFO) << "Wait for exec took " << *waiting_for_exec; + waiting_for_exec.reset(); + } +} + +bool start_waiting_for_property(const char *name, const char *value) { if (waiting_for_prop) { return false; @@ -142,7 +159,8 @@ bool wait_property(const char *name, const char *value) wait_prop_value = value; waiting_for_prop.reset(new Timer()); } else { - LOG(INFO) << "wait_property(\"" << name << "\", \"" << value << "\"): already set"; + LOG(INFO) << "start_waiting_for_property(\"" + << name << "\", \"" << value << "\"): already set"; } return true; } |