IO::Async::Loop::Epoll - a Loop using an IO::Epoll object
IO::Epoll
use IO::Async::Loop::Epoll; my $loop = IO::Async::Loop::Epoll->new(); $loop->add( ... ); $loop->attach_signal( HUP => sub { ... } ); $loop->loop_forever();
This subclass of IO::Async::Loop::IO_Poll uses an IO::Epoll object instead of a IO::Poll to perform read-ready and write-ready tests so that the O(1) high-performance multiplexing of Linux's epoll_pwait(2) syscall can be used.
IO::Async::Loop::IO_Poll
IO::Poll
epoll_pwait(2)
The epoll Linux subsystem uses a registration system similar to the higher level IO::Poll object wrapper, meaning that better performance can be achieved in programs using a large number of filehandles. Each epoll_pwait(2) syscall only has an overhead proportional to the number of ready filehandles, rather than the total number being watched. For more detail, see the epoll(7) manpage.
epoll
epoll(7)
This class uses the epoll_pwait(2) system call, which atomically switches the process's signal mask, performs a wait exactly as epoll_wait(2) would, then switches it back. This allows a process to block the signals it cares about, but switch in an empty signal mask during the poll, allowing it to handle file IO and signals concurrently.
epoll_wait(2)
This function returns a new instance of a IO::Async::Loop::Epoll object. It takes the following named arguments:
IO::Async::Loop::Epoll
poll
The IO::Epoll object to use for notification. Optional; if a value is not given, a new IO::Epoll object will be constructed.
As this is a subclass of IO::Async::Loop::IO_Poll, all of its methods are inherited. Expect where noted below, all of the class's methods behave identically to IO::Async::Loop::IO_Poll.
This method calls the poll() method on the stored IO::Epoll object, passing in the value of $timeout, and processes the results of that call. It returns the total number of IO::Async::Notifier callbacks invoked, or undef if the underlying epoll_pwait() method returned an error. If the epoll_pwait() was interrupted by a signal, then 0 is returned instead.
poll()
$timeout
IO::Async::Notifier
undef
epoll_pwait()
IO::Epoll - Scalable IO Multiplexing for Linux 2.5.44 and higher
IO::Async::Loop::IO_Poll - a Loop using an IO::Poll object
Paul Evans <leonerd@leonerd.org.uk>
To install IO::Async::Loop::Epoll, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::Async::Loop::Epoll
CPAN shell
perl -MCPAN -e shell install IO::Async::Loop::Epoll
For more information on module installation, please visit the detailed CPAN module installation guide.