1IO::Async::Loop::Poll(3U)ser Contributed Perl DocumentatiIoOn::Async::Loop::Poll(3)
2
3
4

NAME

6       "IO::Async::Loop::Poll" - use "IO::Async" with "poll(2)"
7

SYNOPSIS

9        use IO::Async::Loop::Poll;
10
11        my $loop = IO::Async::Loop::Poll->new();
12
13        $loop->add( ... );
14
15        $loop->loop_forever();
16
17       Or
18
19        while(1) {
20           $loop->loop_once();
21           ...
22        }
23
24       Or
25
26        use IO::Poll;
27        use IO::Async::Loop::Poll;
28
29        my $poll = IO::Poll->new();
30        my $loop = IO::Async::Loop::Poll->new( poll => $poll );
31
32        $loop->add( ... );
33
34        while(1) {
35           my $timeout = ...
36           my $ret = $poll->poll( $timeout );
37           $loop->post_poll();
38        }
39

DESCRIPTION

41       This subclass of "IO::Async::Loop" uses an "IO::Poll" object to perform
42       read-ready and write-ready tests.
43
44       To integrate with existing code that uses an "IO::Poll", a
45       "post_poll()" can be called immediately after the "poll()" method on
46       the contained "IO::Poll" object. The appropriate mask bits are
47       maintained on the "IO::Poll" object when notifiers are added or removed
48       from the set, or when they change their "want_writeready" status. The
49       "post_poll()" method inspects the result bits and invokes the
50       "on_read_ready()" or "on_write_ready()" methods on the notifiers.
51

CONSTRUCTOR

53   $loop = IO::Async::Loop::Poll->new( %args )
54       This function returns a new instance of a "IO::Async::Loop::Poll"
55       object. It takes the following named arguments:
56
57       "poll"  The "IO::Poll" object to use for notification. Optional; if a
58               value is not given, a new "IO::Poll" object will be
59               constructed.
60

METHODS

62   $count = $loop->post_poll( $poll )
63       This method checks the returned event list from a "IO::Poll::poll()"
64       call, and calls any of the notification methods or callbacks that are
65       appropriate.  It returns the total number of callbacks that were
66       invoked; that is, the total number of "on_read_ready" and
67       "on_write_ready" callbacks for "watch_io", and "enqueue_timer" event
68       callbacks.
69
70       $poll   Reference to the "IO::Poll" object
71
72   $count = $loop->loop_once( $timeout )
73       This method calls the "poll()" method on the stored "IO::Poll" object,
74       passing in the value of $timeout, and then runs the "post_poll()"
75       method on itself. It returns the total number of callbacks invoked by
76       the "post_poll()" method, or "undef" if the underlying "poll()" method
77       returned an error.
78

AUTHOR

80       Paul Evans <leonerd@leonerd.org.uk>
81
82
83
84perl v5.12.1                      2010-06-09          IO::Async::Loop::Poll(3)
Impressum