diff --git a/init/epoll.cpp b/init/epoll.cpp index f814c6530..fd1af4fff 100644 --- a/init/epoll.cpp +++ b/init/epoll.cpp @@ -48,7 +48,7 @@ Result Epoll::RegisterHandler(int fd, Handler handler, uint32_t events) { auto [it, inserted] = epoll_handlers_.emplace( fd, Info{ .events = events, - .handler = std::make_shared(std::move(handler)), + .handler = std::move(handler), }); if (!inserted) { return Error() << "Cannot specify two epoll handlers for a given FD"; @@ -107,7 +107,7 @@ Result Epoll::Wait(std::optional timeout) { // 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); } diff --git a/init/epoll.h b/init/epoll.h index 585313435..1e71803f6 100644 --- a/init/epoll.h +++ b/init/epoll.h @@ -48,7 +48,7 @@ class Epoll { private: struct Info { - std::shared_ptr handler; + Handler handler; uint32_t events; };