Commit 92fc53eb authored by Max Kellermann's avatar Max Kellermann

event/PollGroupWinSelect: use range-based `for`

parent 7e7a1613
......@@ -150,19 +150,19 @@ PollGroupWinSelect::ReadEvents(PollResultGeneric &result,
if (ret == 0 || ret == SOCKET_ERROR)
return;
for (size_t i = 0; i < read_set.Size(); ++i)
items[read_set[i]].events |= READ;
for (const auto i : read_set)
items[i].events |= READ;
for (size_t i = 0; i < write_set.Size(); ++i)
items[write_set[i]].events |= WRITE;
for (const auto i : write_set)
items[i].events |= WRITE;
for (size_t i = 0; i < except_set.Size(); ++i)
items[except_set[i]].events |= WRITE;
for (const auto i : except_set)
items[i].events |= WRITE;
for (auto i = items.begin(); i != items.end(); ++i)
if (i->second.events != 0) {
result.Add(i->second.events, i->second.obj);
i->second.events = 0;
for (auto &i : items)
if (i.second.events != 0) {
result.Add(i.second.events, i.second.obj);
i.second.events = 0;
}
}
......
......@@ -84,6 +84,14 @@ public:
assert(!IsEmpty());
--set.fd_count;
}
const auto *begin() const noexcept {
return set.fd_array;
}
const auto *end() const noexcept {
return set.fd_array + set.fd_count;
}
};
class PollGroupWinSelect
......
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