Rechercher une page de manuel
IO::Async::Loop::Poll.3pm
Langue: en
Version: 2010-06-09 (fedora - 01/12/10)
Section: 3 (Bibliothèques de fonctions)
Sommaire
NAME
"IO::Async::Loop::Poll" - use "IO::Async" with "poll(2)"SYNOPSIS
use IO::Async::Loop::Poll; my $loop = IO::Async::Loop::Poll->new(); $loop->add( ... ); $loop->loop_forever();
Or
while(1) { $loop->loop_once(); ... }
Or
use IO::Poll; use IO::Async::Loop::Poll; my $poll = IO::Poll->new(); my $loop = IO::Async::Loop::Poll->new( poll => $poll ); $loop->add( ... ); while(1) { my $timeout = ... my $ret = $poll->poll( $timeout ); $loop->post_poll(); }
DESCRIPTION
This subclass of "IO::Async::Loop" uses an "IO::Poll" object to perform read-ready and write-ready tests.To integrate with existing code that uses an "IO::Poll", a "post_poll()" can be called immediately after the "poll()" method on the contained "IO::Poll" object. The appropriate mask bits are maintained on the "IO::Poll" object when notifiers are added or removed from the set, or when they change their "want_writeready" status. The "post_poll()" method inspects the result bits and invokes the "on_read_ready()" or "on_write_ready()" methods on the notifiers.
CONSTRUCTOR
$loop = IO::Async::Loop::Poll->new( %args )
This function returns a new instance of a "IO::Async::Loop::Poll" object. It takes the following named arguments:- poll
- The "IO::Poll" object to use for notification. Optional; if a value is not given, a new "IO::Poll" object will be constructed.
METHODS
$count = $loop->post_poll( $poll )
This method checks the returned event list from a "IO::Poll::poll()" call, and calls any of the notification methods or callbacks that are appropriate. It returns the total number of callbacks that were invoked; that is, the total number of "on_read_ready" and "on_write_ready" callbacks for "watch_io", and "enqueue_timer" event callbacks.- $poll
- Reference to the "IO::Poll" object
$count = $loop->loop_once( $timeout )
This method calls the "poll()" method on the stored "IO::Poll" object, passing in the value of $timeout, and then runs the "post_poll()" method on itself. It returns the total number of callbacks invoked by the "post_poll()" method, or "undef" if the underlying "poll()" method returned an error.AUTHOR
Paul Evans <leonerd@leonerd.org.uk>Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre