init: Introduce Epoll::SetFirstCallback()
Prepare for optimizing Epoll::Wait() by moving the
ReapAnyOutstandingChildren() call into Epoll::Wait(). No functionality
is changed.
Bug: 213617178
Change-Id: I280ea0069ed29cf323e4177ec500b30b900f7c8d
Signed-off-by: Bart Van Assche <bvanassche@google.com>
diff --git a/init/epoll.h b/init/epoll.h
index f58ae8d..e26e319 100644
--- a/init/epoll.h
+++ b/init/epoll.h
@@ -42,6 +42,7 @@
Result<void> Open();
Result<void> RegisterHandler(int fd, Handler handler, uint32_t events = EPOLLIN);
Result<void> UnregisterHandler(int fd);
+ void SetFirstCallback(std::function<void()> first_callback);
Result<std::vector<std::shared_ptr<Handler>>> Wait(
std::optional<std::chrono::milliseconds> timeout);
@@ -53,6 +54,7 @@
android::base::unique_fd epoll_fd_;
std::map<int, Info> epoll_handlers_;
+ std::function<void()> first_callback_;
};
} // namespace init