Commit be3d2188 authored by Max Kellermann's avatar Max Kellermann

event/SocketMonitor: wake up the event loop after flag change

parent 18e429a8
......@@ -159,3 +159,9 @@ SocketMonitor::Write(const void *data, size_t length)
return send(Get(), (const char *)data, length, flags);
}
void
SocketMonitor::CommitEventFlags()
{
loop.WakeUp();
}
......@@ -89,26 +89,32 @@ public:
void Schedule(unsigned flags) {
poll.events = flags;
poll.revents &= flags;
CommitEventFlags();
}
void Cancel() {
poll.events = 0;
CommitEventFlags();
}
void ScheduleRead() {
poll.events |= READ|HANGUP|ERROR;
CommitEventFlags();
}
void ScheduleWrite() {
poll.events |= WRITE;
CommitEventFlags();
}
void CancelRead() {
poll.events &= ~(READ|HANGUP|ERROR);
CommitEventFlags();
}
void CancelWrite() {
poll.events &= ~WRITE;
CommitEventFlags();
}
ssize_t Read(void *data, size_t length);
......@@ -128,6 +134,8 @@ public:
gpointer user_data);
private:
void CommitEventFlags();
bool Check() const {
return (poll.revents & poll.events) != 0;
}
......
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