.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "IO::Async::Loop::Epoll 3pm" .TH IO::Async::Loop::Epoll 3pm 2024-02-25 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "IO::Async::Loop::Epoll" \- use "IO::Async" with "epoll" on Linux .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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 => \e*STDIN, \& on_read => sub { \& my ( $self, $buffref ) = @_; \& while( $$buffref =~ s/^(.*)\er?\en// ) { \& print "You said: $1\en"; \& } \& }, \& ) ); \& \& $loop\->add( IO::Async::Signal\->new( \& name => \*(AqINT\*(Aq, \& on_receipt => sub { \& print "SIGINT, will now quit\en"; \& $loop\->stop; \& }, \& ) ); \& \& $loop\->run; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This subclass of IO::Async::Loop uses \f(CWepoll(7)\fR on Linux to perform read-ready and write-ready tests so that the O(1) high-performance multiplexing of Linux's \f(CWepoll_pwait(2)\fR syscall can be used. .PP The \f(CW\*(C`epoll\*(C'\fR Linux subsystem uses a persistent registration system, meaning that better performance can be achieved in programs using a large number of filehandles. Each \f(CWepoll_pwait(2)\fR syscall only has an overhead proportional to the number of ready filehandles, rather than the total number being watched. For more detail, see the \f(CWepoll(7)\fR manpage. .PP This class uses the \f(CWepoll_pwait(2)\fR system call, which atomically switches the process's signal mask, performs a wait exactly as \f(CWepoll_wait(2)\fR 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. .SH CONSTRUCTOR .IX Header "CONSTRUCTOR" .SS new .IX Subsection "new" .Vb 1 \& $loop = IO::Async::Loop::Epoll\->new() .Ve .PP This function returns a new instance of a \f(CW\*(C`IO::Async::Loop::Epoll\*(C'\fR object. .SH METHODS .IX Header "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 \&\f(CW\*(C`IO::Async::Loop\*(C'\fR. .SS loop_once .IX Subsection "loop_once" .Vb 1 \& $count = $loop\->loop_once( $timeout ) .Ve .PP This method calls \f(CWepoll_pwait(2)\fR, and processes the results of that call. It returns the total number of \f(CW\*(C`IO::Async::Notifier\*(C'\fR callbacks invoked, or \&\f(CW\*(C`undef\*(C'\fR if the underlying \f(CWepoll_pwait()\fR method returned an error. If the \&\f(CWepoll_pwait()\fR was interrupted by a signal, then 0 is returned instead. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 Linux::Epoll \- O(1) multiplexing for Linux .IP \(bu 4 IO::Async::Loop::Poll \- use IO::Async with \fBpoll\fR\|(2) .SH AUTHOR .IX Header "AUTHOR" Paul Evans