Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

io::async::loop::epoll(3pm) [debian man page]

IO::Async::Loop::Epoll(3pm)				User Contributed Perl Documentation			       IO::Async::Loop::Epoll(3pm)

NAME
IO::Async::Loop::Epoll - use "IO::Async" with "epoll" on Linux SYNOPSIS
use IO::Async::Loop::Epoll; use IO::Async::Stream; use IO::Async::Signal; my $loop = IO::Async::Loop::Epoll->new(); $loop->add( IO::Async::Stream->new( read_handle => *STDIN, on_read => sub { my ( $self, $buffref ) = @_; while( $$buffref =~ s/^(.*) ? // ) { print "You said: $1 "; } }, ) ); $loop->add( IO::Async::Signal->new( name => 'INT', on_receipt => sub { print "SIGINT, will now quit "; $loop->loop_stop; }, ) ); $loop->loop_forever(); DESCRIPTION
This subclass of IO::Async::Loop uses IO::Epoll 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. 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. 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. CONSTRUCTOR
$loop = IO::Async::Loop::Epoll->new() This function returns a new instance of a "IO::Async::Loop::Epoll" object. METHODS
As this is a subclass of IO::Async::Loop, all of its methods are inherited. Expect where noted below, all of the class's methods behave identically to "IO::Async::Loop". $count = $loop->loop_once( $timeout ) 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. SEE ALSO
o IO::Epoll - Scalable IO Multiplexing for Linux 2.5.44 and higher o IO::Async::Loop::Poll - use IO::Async with poll(2) AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-04-10 IO::Async::Loop::Epoll(3pm)

Check Out this Related Man Page

IO::Async::PID(3pm)					User Contributed Perl Documentation				       IO::Async::PID(3pm)

NAME
"IO::Async::PID" - event callback on exit of a child process SYNOPSIS
use IO::Async::PID; use POSIX qw( WEXITSTATUS ); use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $kid = $loop->fork( code => sub { print "Child sleeping.. "; sleep 10; print "Child exiting "; return 20; }, ); print "Child process $kid started "; my $pid = IO::Async::PID->new( pid => $kid, on_exit => sub { my ( $self, $exitcode ) = @_; printf "Child process %d exited with status %d ", $self->pid, WEXITSTATUS($exitcode); }, ); $loop->add( $pid ); $loop->run; DESCRIPTION
This subclass of IO::Async::Notifier invokes its callback when a process exits. For most use cases, a IO::Async::Process object provides more control of setting up the process, connecting filehandles to it, sending data to and receiving data from it. EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters: on_exit $exitcode Invoked when the watched process exits. PARAMETERS
The following named parameters may be passed to "new" or "configure": pid => INT The process ID to watch. Must be given before the object has been added to the containing "IO::Async::Loop" object. on_exit => CODE CODE reference for the "on_exit" event. Once the "on_exit" continuation has been invoked, the "IO::Async::PID" object is removed from the containing "IO::Async::Loop" object. METHODS
$process_id = $pid->pid Returns the underlying process ID $pid->kill( $signal ) Sends a signal to the process AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::PID(3pm)
Man Page