MCPcopy Create free account
hub / github.com/dermesser/libsocket / wait

Method wait

headers/epoll.hpp:187–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185 */
186template <typename SocketT>
187typename epollset<SocketT>::ready_socks epollset<SocketT>::wait(int timeout) {
188 int nfds;
189 ready_socks ready;
190
191 if (0 > (nfds = epoll_wait(epollfd, events, maxevents, timeout)))
192 throw socket_exception(__FILE__, __LINE__,
193 string("epoll_wait failed: ") + strerror(errno));
194
195 for (int i = 0; i < nfds; i++) {
196 if (events[i].events == EPOLLIN)
197 ready.first.push_back(static_cast<SocketT*>(events[i].data.ptr));
198 if (events[i].events == EPOLLOUT)
199 ready.second.push_back(static_cast<SocketT*>(events[i].data.ptr));
200 }
201
202 return ready;
203}
204
205} // namespace libsocket
206#endif

Callers 2

mainFunction · 0.45
mainFunction · 0.45

Calls 1

socket_exceptionClass · 0.85

Tested by

no test coverage detected