NAME ==== epoll - I/O event notification facility SYNOPSIS ======== use epoll; my $epoll = epoll.new(maxevents => 1); # 1 is default $epoll.add($file-descriptor, :in, :out, :priority, :edge-triggered); # timeout in milliseconds, default -1 = block forever for $epoll.wait(:2000timeout) { say "{.fd} is ready for reading" if .in; say "{.fd} is ready for writing" if .out; } # Or use chained calls: for epoll.new.add(0, :in).wait { say "ready to read on {.fd}" if .in; } DESCRIPTION =========== Simple low level interface around the Linux `epoll(7)` I/O event notification facility. It can monitor multiple file descriptors to see if I/O is possible on any of them. Mainly useful for interfacing with other NativeCall modules, since Perl itself has a rich I/O system. If you really want to use this with Perl `IO::Handle`s, you can use `native-descriptor()` to get a suitable descriptor. class **epoll** --------------- * method **new**(:$maxevents = 1) Create a new epoll object. Maxevents is the maximum number of events that can be returned from a single call to wait. * method **add**(int32 $file-descriptor, ...event flags...) Flags:
:in | EPOLLIN | ready for read |
:out | EPOLLOUT | ready for write |
:priority | EPOLLPRI | urgent data available for read |
:edge-triggered | EPOLLET | Edge Triggered |
:one-shot | EPOLLONESHOT | Disables after 1 event |
:mod | EPOLL_CTL_MOD | Modify an existing file descriptor |