Commit 935e6229 authored by Max Kellermann's avatar Max Kellermann

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

Relax the assertions. This is necessary if BlockingCall() is used before the thread is started.
parent 1efbbfcd
...@@ -55,7 +55,7 @@ EventLoop::Break() noexcept ...@@ -55,7 +55,7 @@ EventLoop::Break() noexcept
bool bool
EventLoop::Abandon(int _fd, SocketMonitor &m) noexcept EventLoop::Abandon(int _fd, SocketMonitor &m) noexcept
{ {
assert(IsInside()); assert(!IsAlive() || IsInside());
poll_result.Clear(&m); poll_result.Clear(&m);
return poll_group.Abandon(_fd); return poll_group.Abandon(_fd);
...@@ -64,7 +64,7 @@ EventLoop::Abandon(int _fd, SocketMonitor &m) noexcept ...@@ -64,7 +64,7 @@ EventLoop::Abandon(int _fd, SocketMonitor &m) noexcept
bool bool
EventLoop::RemoveFD(int _fd, SocketMonitor &m) noexcept EventLoop::RemoveFD(int _fd, SocketMonitor &m) noexcept
{ {
assert(IsInside()); assert(!IsAlive() || IsInside());
poll_result.Clear(&m); poll_result.Clear(&m);
return poll_group.Remove(_fd); return poll_group.Remove(_fd);
......
...@@ -143,13 +143,13 @@ public: ...@@ -143,13 +143,13 @@ public:
void Break() noexcept; void Break() noexcept;
bool AddFD(int _fd, unsigned flags, SocketMonitor &m) noexcept { bool AddFD(int _fd, unsigned flags, SocketMonitor &m) noexcept {
assert(IsInside()); assert(!IsAlive() || IsInside());
return poll_group.Add(_fd, flags, &m); return poll_group.Add(_fd, flags, &m);
} }
bool ModifyFD(int _fd, unsigned flags, SocketMonitor &m) noexcept { bool ModifyFD(int _fd, unsigned flags, SocketMonitor &m) noexcept {
assert(IsInside()); assert(!IsAlive() || IsInside());
return poll_group.Modify(_fd, flags, &m); return poll_group.Modify(_fd, flags, &m);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment