event/SocketEvent: add ScheduleImplicit(), Is{Read,Write}Pending()
This commit is contained in:
parent
8849b9b62c
commit
725985379a
@ -94,6 +94,16 @@ SocketEvent::Schedule(unsigned flags) noexcept
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
SocketEvent::ScheduleImplicit() noexcept
|
||||
{
|
||||
assert(IsDefined());
|
||||
assert(scheduled_flags == 0);
|
||||
|
||||
scheduled_flags = IMPLICIT_FLAGS;
|
||||
loop.AddFD(fd.Get(), scheduled_flags, *this);
|
||||
}
|
||||
|
||||
void
|
||||
SocketEvent::Dispatch() noexcept
|
||||
{
|
||||
|
@ -167,6 +167,21 @@ public:
|
||||
Schedule(GetScheduledFlags() & ~WRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule only the #IMPLICIT_FLAGS without #READ and #WRITE.
|
||||
* This is not possible with Schedule(), and no other
|
||||
* ScheduleX()/CancelX() method may be called on this object.
|
||||
*/
|
||||
void ScheduleImplicit() noexcept;
|
||||
|
||||
bool IsReadPending() const noexcept {
|
||||
return GetScheduledFlags() & READ;
|
||||
}
|
||||
|
||||
bool IsWritePending() const noexcept {
|
||||
return GetScheduledFlags() & WRITE;
|
||||
}
|
||||
|
||||
public:
|
||||
void Dispatch() noexcept;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user