x::epoll
is a reference, and
x::epollptr
is a nullable pointer reference
to a reference-counted object that implements the
Linux kernel epoll(7) API.
class myEpollCallbackObj : public x::epoll::callbackObj { public: myEpollCallbackObj(); ~myEpollCallbackObj(); void event(const fd &fileDesc, event_t events); }; x::ref<myEpollCallbackObj> cb(x::ref<myEpollCallbackObj>::create()); x::epoll epollSet(x::epoll::create()); x::fd myFd(netaddr("mail.example.com", "smtp")->connect(); myFd->epoll(EPOLLIN, epollSet, cb);
A file descriptor object's epoll
() method
adds the file descriptor to the epoll set, and attaches a callback object
to the file descriptor.
An epoll object's epoll_wait
waits for an
event to occur in the event set, after which the event() method from
the file descriptor's associated callback object gets invoked, with
parameters indicating which file descriptor's event has occured, and
what the event is.