event/Loop: allow calling AddFD()... before starting the EventThread

Relax the assertions.  This is necessary if BlockingCall() is used
before the thread is started.
This commit is contained in:
Max Kellermann 2020-05-05 17:08:52 +02:00
parent 1efbbfcd6f
commit 935e622915
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ EventLoop::Break() noexcept
bool
EventLoop::Abandon(int _fd, SocketMonitor &m) noexcept
{
assert(IsInside());
assert(!IsAlive() || IsInside());
poll_result.Clear(&m);
return poll_group.Abandon(_fd);
@ -64,7 +64,7 @@ EventLoop::Abandon(int _fd, SocketMonitor &m) noexcept
bool
EventLoop::RemoveFD(int _fd, SocketMonitor &m) noexcept
{
assert(IsInside());
assert(!IsAlive() || IsInside());
poll_result.Clear(&m);
return poll_group.Remove(_fd);

View File

@ -143,13 +143,13 @@ public:
void Break() noexcept;
bool AddFD(int _fd, unsigned flags, SocketMonitor &m) noexcept {
assert(IsInside());
assert(!IsAlive() || IsInside());
return poll_group.Add(_fd, flags, &m);
}
bool ModifyFD(int _fd, unsigned flags, SocketMonitor &m) noexcept {
assert(IsInside());
assert(!IsAlive() || IsInside());
return poll_group.Modify(_fd, flags, &m);
}