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:
parent
1efbbfcd6f
commit
935e622915
|
@ -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
|
||||||
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:
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue