event/SocketEvent: add Abandon()

This commit is contained in:
Max Kellermann
2020-10-15 16:55:43 +02:00
parent f8ff597963
commit caa2611ad5
2 changed files with 21 additions and 0 deletions
+9
View File
@@ -85,6 +85,15 @@ SocketEvent::Schedule(unsigned flags) noexcept
return success;
}
void
SocketEvent::Abandon() noexcept
{
if (std::exchange(scheduled_flags, 0) != 0)
loop.AbandonFD(fd.Get());
fd = SocketDescriptor::Undefined();
}
void
SocketEvent::Dispatch() noexcept
{