init/epoll: Stop using smart pointers
Change the type of 'handler' from std::shared_ptr<Handler> into Handler.
This change is safe since a previous CL moved the handler calls from the
Epoll::Wait() caller into Epoll::Wait() itself.
Bug: 213617178
Change-Id: Ife79e6863536b96ee4bb3cd778f6b0b164a95fed
Signed-off-by: Bart Van Assche <bvanassche@google.com>
diff --git a/init/epoll.cpp b/init/epoll.cpp
index f814c65..fd1af4f 100644
--- a/init/epoll.cpp
+++ b/init/epoll.cpp
@@ -48,7 +48,7 @@
auto [it, inserted] = epoll_handlers_.emplace(
fd, Info{
.events = events,
- .handler = std::make_shared<Handler>(std::move(handler)),
+ .handler = std::move(handler),
});
if (!inserted) {
return Error() << "Cannot specify two epoll handlers for a given FD";
@@ -107,7 +107,7 @@
// Log something informational.
LOG(ERROR) << "Received unexpected epoll event set: " << ev[i].events;
}
- (*info.handler)();
+ info.handler();
for (auto fd : to_remove_) {
epoll_handlers_.erase(fd);
}