20 #ifndef MPD_EVENT_POLLGROUP_EPOLL_HXX
21 #define MPD_EVENT_POLLGROUP_EPOLL_HXX
35 std::array<epoll_event, 16> events;
41 unsigned GetEvents(
int i)
const {
return events[i].events; }
42 void *
GetObject(
int i)
const {
return events[i].data.ptr; }
46 for (
int i = 0; i < n_events; ++i)
47 if (events[i].data.ptr == obj)
59 static constexpr
unsigned READ = EPOLLIN;
60 static constexpr
unsigned WRITE = EPOLLOUT;
61 static constexpr
unsigned ERROR = EPOLLERR;
62 static constexpr
unsigned HANGUP = EPOLLHUP;
67 int ret = epoll.
Wait(result.events.data(), result.events.size(),
69 result.n_events = std::max(0, ret);
72 bool Add(
int fd,
unsigned events,
void *obj) {
73 return epoll.
Add(fd, events, obj);
76 bool Modify(
int fd,
unsigned events,
void *obj) {
77 return epoll.
Modify(fd, events, obj);
static constexpr unsigned WRITE
int Wait(epoll_event *events, int maxevents, int timeout)
void * GetObject(int i) const
static constexpr unsigned ERROR
unsigned GetEvents(int i) const
A class that wraps Linux epoll.
static constexpr unsigned HANGUP
bool Add(int _fd, uint32_t events, void *ptr)
bool Modify(int fd, unsigned events, void *obj)
static constexpr unsigned READ
void ReadEvents(PollResultEPoll &result, int timeout_ms)
bool Add(int fd, unsigned events, void *obj)
bool Modify(int _fd, uint32_t events, void *ptr)
bool Abandon(gcc_unused int fd)