event/SocketMonitor: add method Abandon()

This commit is contained in:
Max Kellermann
2013-11-06 18:20:51 +01:00
parent ed436c6f0c
commit 154bdf0bca
4 changed files with 32 additions and 2 deletions

View File

@@ -58,13 +58,18 @@ EventLoop::Break()
AddCall([this]() { Break(); });
}
bool
EventLoop::RemoveFD(int _fd, SocketMonitor &m)
void
EventLoop::Abandon(SocketMonitor &m)
{
for (unsigned i = 0, n = n_events; i < n; ++i)
if (events[i].data.ptr == &m)
events[i].events = 0;
}
bool
EventLoop::RemoveFD(int _fd, SocketMonitor &m)
{
Abandon(m);
return epoll.Remove(_fd);
}