20 #ifndef MPD_EPOLL_FD_HXX 21 #define MPD_EPOLL_FD_HXX 24 #include <sys/epoll.h> 52 int Wait(epoll_event *events,
int maxevents,
int timeout) {
53 return ::epoll_wait(fd, events, maxevents, timeout);
56 bool Control(
int op,
int _fd, epoll_event *event) {
57 return ::epoll_ctl(fd, op, _fd, event) >= 0;
60 bool Add(
int _fd, uint32_t events,
void *ptr) {
65 return Control(EPOLL_CTL_ADD, _fd, &
e);
68 bool Modify(
int _fd, uint32_t events,
void *ptr) {
73 return Control(EPOLL_CTL_MOD, _fd, &
e);
77 return Control(EPOLL_CTL_DEL, _fd,
nullptr);
int Wait(epoll_event *events, int maxevents, int timeout)
bool Control(int op, int _fd, epoll_event *event)
A class that wraps Linux epoll.
bool Add(int _fd, uint32_t events, void *ptr)
bool Modify(int _fd, uint32_t events, void *ptr)
EPollFD & operator=(const EPollFD &other)=delete