init: Make WaitToBeReaped() wait less long
Reduce the time spent in WaitToBeReaped() by waiting for SIGCHLD instead
of waiting for 50 ms.
Bug: 308687042
Change-Id: I5e259fdd22dec68e45d27205def2fc6463c06ca3
Signed-off-by: Bart Van Assche <bvanassche@google.com>
diff --git a/init/service.h b/init/service.h
index 9f09cef..7e73af6 100644
--- a/init/service.h
+++ b/init/service.h
@@ -156,6 +156,7 @@
const Subcontext* subcontext() const { return subcontext_; }
const std::string& filename() const { return filename_; }
void set_filename(const std::string& name) { filename_ = name; }
+ static void SetSigchldFd(int sigchld_fd) { sigchld_fd_ = sigchld_fd; }
private:
void NotifyStateChange(const std::string& new_state) const;
@@ -168,8 +169,10 @@
void RunService(const std::vector<Descriptor>& descriptors, InterprocessFifo cgroups_activated,
InterprocessFifo setsid_finished);
void SetMountNamespace();
+
static unsigned long next_start_order_;
static bool is_exec_service_running_;
+ static int sigchld_fd_;
const std::string name_;
std::set<std::string> classnames_;