From dd94f97572817832544c0cf6110a1201c72c40e8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 18 Oct 2020 19:43:35 +0200 Subject: [PATCH] event/Loop: un-inline AddFD(), ModifyFD() Prepare for adding more code here. --- src/event/Loop.cxx | 24 ++++++++++++++++++++++-- src/event/Loop.hxx | 18 ++---------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/event/Loop.cxx b/src/event/Loop.cxx index 6631c41c7..afc62b2f7 100644 --- a/src/event/Loop.cxx +++ b/src/event/Loop.cxx @@ -111,13 +111,33 @@ EventLoop::AbandonFD(int _fd) noexcept } bool -EventLoop::RemoveFD(int _fd) noexcept +EventLoop::AddFD(int fd, unsigned events, SocketEvent &event) noexcept { #ifdef HAVE_THREADED_EVENT_LOOP assert(!IsAlive() || IsInside()); #endif - return poll_group.Remove(_fd); + return poll_group.Add(fd, events, &event); +} + +bool +EventLoop::ModifyFD(int fd, unsigned events, SocketEvent &event) noexcept +{ +#ifdef HAVE_THREADED_EVENT_LOOP + assert(!IsAlive() || IsInside()); +#endif + + return poll_group.Modify(fd, events, &event); +} + +bool +EventLoop::RemoveFD(int fd) noexcept +{ +#ifdef HAVE_THREADED_EVENT_LOOP + assert(!IsAlive() || IsInside()); +#endif + + return poll_group.Remove(fd); } void diff --git a/src/event/Loop.hxx b/src/event/Loop.hxx index a1d7be855..864215995 100644 --- a/src/event/Loop.hxx +++ b/src/event/Loop.hxx @@ -186,22 +186,8 @@ public: */ void Break() noexcept; - bool AddFD(int _fd, unsigned flags, SocketEvent &m) noexcept { -#ifdef HAVE_THREADED_EVENT_LOOP - assert(!IsAlive() || IsInside()); -#endif - - return poll_group.Add(_fd, flags, &m); - } - - bool ModifyFD(int _fd, unsigned flags, SocketEvent &m) noexcept { -#ifdef HAVE_THREADED_EVENT_LOOP - assert(!IsAlive() || IsInside()); -#endif - - return poll_group.Modify(_fd, flags, &m); - } - + bool AddFD(int fd, unsigned events, SocketEvent &event) noexcept; + bool ModifyFD(int fd, unsigned events, SocketEvent &event) noexcept; bool RemoveFD(int fd) noexcept; /**