event/MultiSocketMonitor: un-inline AddSocket()

This commit is contained in:
Max Kellermann 2019-12-22 12:00:12 +01:00
parent dcbb9fe07c
commit 7764719513
2 changed files with 13 additions and 9 deletions

View File

@ -42,6 +42,18 @@ MultiSocketMonitor::Reset() noexcept
ready = refresh = false; ready = refresh = false;
} }
bool
MultiSocketMonitor::AddSocket(SocketDescriptor fd, unsigned events) noexcept
{
fds.emplace_front(*this, fd);
bool success = fds.front().Schedule(events);
if (!success) {
fds.pop_front();
}
return success;
}
void void
MultiSocketMonitor::ClearSocketList() noexcept MultiSocketMonitor::ClearSocketList() noexcept
{ {

View File

@ -145,15 +145,7 @@ public:
* *
* May only be called from PrepareSockets(). * May only be called from PrepareSockets().
*/ */
bool AddSocket(SocketDescriptor fd, unsigned events) noexcept { bool AddSocket(SocketDescriptor fd, unsigned events) noexcept;
fds.emplace_front(*this, fd);
bool success = fds.front().Schedule(events);
if (!success) {
fds.pop_front();
}
return success;
}
/** /**
* Remove all sockets. * Remove all sockets.