events/MultiSocketMonitor: add method ForEachResult()
This commit is contained in:
parent
12308a0f55
commit
ba5c856f15
@ -194,6 +194,19 @@ public:
|
|||||||
void ReplaceSocketList(pollfd *pfds, unsigned n) noexcept;
|
void ReplaceSocketList(pollfd *pfds, unsigned n) noexcept;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoke a function for each socket which has become ready.
|
||||||
|
*/
|
||||||
|
template<typename F>
|
||||||
|
void ForEachReturnedEvent(F &&f) noexcept {
|
||||||
|
for (auto &i : fds) {
|
||||||
|
if (i.GetReturnedEvents() != 0) {
|
||||||
|
f(i.GetSocket(), i.GetReturnedEvents());
|
||||||
|
i.ClearReturnedEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Override this method and update the socket registrations.
|
* Override this method and update the socket registrations.
|
||||||
|
Loading…
Reference in New Issue
Block a user