void Epoll::add(Socket::Ptr p_socket, const EventTypes& p_ets) const { int fd = p_socket->getDescriptor(); int option = EPOLL_CTL_ADD; epoll_event e; ::memset(&e, 0, sizeof(e)); e.data.fd = fd; e.events = nativeEvents(p_ets); if (::epoll_ctl(m_epollFd, option, fd, &e) < 0) { throw std::runtime_error("Add handler to epoll failed"); } }
void Epoll::modify(Socket::Ptr p_socket, const EventTypes& p_ets) const { int option = EPOLL_CTL_MOD; epollCtl(option, p_socket->getDescriptor(), p_ets); }