| 1 | package POE::Loop::EV; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # EV.pm (libev) event loop bridge | ||||||||||||||||||||||||||||
| 4 | # $Id: EV.pm 27 2008-01-29 19:42:57Z andyg $ | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 137 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 137 | ▶ | use POE::Loop::PerlSignals; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 137 | our $VERSION = '0.13'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =for poe_tests | ||||||||||||||||||||||||||||
| 12 | sub skip_tests { | ||||||||||||||||||||||||||||
| 13 | return "EV tests require the EV module" if ( | ||||||||||||||||||||||||||||
| 14 | do { eval "use EV"; $@ } | ||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||
| 16 | return "wheel_readwrite test disabled for kqueue" | ||||||||||||||||||||||||||||
| 17 | if EV::backend() == EV::BACKEND_KQUEUE() && $_[0] eq 'wheel_readwrite'; | ||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | # Everything plugs into POE::Kernel. | ||||||||||||||||||||||||||||
| 23 | package # hide me from PAUSE | ||||||||||||||||||||||||||||
| 24 | POE::Kernel; | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 137 | ▶ | use EV; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # Loop debugging | ||||||||||||||||||||||||||||
| 29 | 12973 | ▶ | sub EV_DEBUG () { $ENV{POE_EV_DEBUG} || 0 } | ||||||||||||||||||||||||||
|
Subroutine
EV_DEBUG: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | # Global EV timer object | ||||||||||||||||||||||||||||
| 32 | 137 | my $_watcher_timer; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # Global list of EV filehandle objects, indexed by fd number | ||||||||||||||||||||||||||||
| 35 | my @fileno_watcher; | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 137 | my $_async_watcher; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 137 | my $DIE_MESSAGE; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | ############################################################################ | ||||||||||||||||||||||||||||
| 42 | # Initialization, Finalization, and the Loop itself | ||||||||||||||||||||||||||||
| 43 | ############################################################################ | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub loop_initialize { | ||||||||||||||||||||||||||||
| 46 | 201 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
loop_initialize: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 201 | ▶ | if ( EV_DEBUG ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | my $methods = { | |||||||||||||||||||||||||||
| 50 | EV::BACKEND_SELECT() => 'select', | ||||||||||||||||||||||||||||
| 51 | EV::BACKEND_POLL() => 'poll', | ||||||||||||||||||||||||||||
| 52 | EV::BACKEND_EPOLL() => 'epoll', | ||||||||||||||||||||||||||||
| 53 | EV::BACKEND_KQUEUE() => 'kqueue', | ||||||||||||||||||||||||||||
| 54 | EV::BACKEND_DEVPOLL() => 'devpoll', | ||||||||||||||||||||||||||||
| 55 | EV::BACKEND_PORT() => 'port', | ||||||||||||||||||||||||||||
| 56 | }; | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | warn "loop_initialize, EV is using method: " . $methods->{ EV::backend() } . "\n"; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | # Set up the global timer object | ||||||||||||||||||||||||||||
| 62 | 201 | $_watcher_timer = EV::periodic( 0, 0, 0, \&_loop_timer_callback ); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | # Workaround so perl signals are handled | ||||||||||||||||||||||||||||
| 65 | 201 | ▶ | $_async_watcher = EV::check(sub { }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 201 | $EV::DIED = \&_die_handler; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | # Timer callback to dispatch events. | ||||||||||||||||||||||||||||
| 71 | sub _loop_timer_callback { | ||||||||||||||||||||||||||||
| 72 | 1863 | ▶ | my $self = $poe_kernel; | ||||||||||||||||||||||||||
|
Subroutine
_loop_timer_callback: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 1863 | ▶ | EV_DEBUG && warn "_loop_timer_callback, at " . time() . "\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 1863 | $self->_data_ev_dispatch_due(); | |||||||||||||||||||||||||||
| 77 | 1863 | $self->_test_if_kernel_is_idle(); | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | # Transferring control back to EV; this is idle time. | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | sub loop_finalize { | ||||||||||||||||||||||||||||
| 83 | 184 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
loop_finalize: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 184 | ▶ | EV_DEBUG && warn "loop_finalize\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 184 | foreach my $fd ( 0 .. $#fileno_watcher ) { | |||||||||||||||||||||||||||
| 88 | 2929 | ▶ | next unless defined $fileno_watcher[ $fd ]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 817 | foreach my $mode ( EV::READ, EV::WRITE ) { | |||||||||||||||||||||||||||
| 90 | 1634 | ▶ | if ( defined $fileno_watcher[ $fd ]->[ $mode ] ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 0 | POE::Kernel::_warn( | |||||||||||||||||||||||||||
| 92 | "Mode $mode watcher for fileno $fd is defined during loop finalize" | ||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 184 | $self->loop_ignore_all_signals(); | |||||||||||||||||||||||||||
| 99 | 184 | undef $_async_watcher; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | ▶ | sub loop_attach_uidestroy { | |||||||||||||||||||||||||||
|
Subroutine
loop_attach_uidestroy: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 103 | # does nothing, no UI | ||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | ▶ | sub loop_do_timeslice { | |||||||||||||||||||||||||||
|
Subroutine
loop_do_timeslice: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 107 | # does nothing | ||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | sub loop_run { | ||||||||||||||||||||||||||||
| 111 | 184 | ▶ | EV_DEBUG && warn "loop_run\n"; | ||||||||||||||||||||||||||
|
Subroutine
loop_run: called CC=3 SCAR=14.2
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 184 | EV::run(); | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 184 | ▶ | if ( defined $DIE_MESSAGE ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 0 | my $message = $DIE_MESSAGE; | |||||||||||||||||||||||||||
| 117 | 0 | undef $DIE_MESSAGE; | |||||||||||||||||||||||||||
| 118 | 0 | die $message; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub loop_halt { | ||||||||||||||||||||||||||||
| 123 | 184 | ▶ | EV_DEBUG && warn "loop_halt\n"; | ||||||||||||||||||||||||||
|
Subroutine
loop_halt: called CC=2 SCAR=7.0
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 184 | $_watcher_timer->stop(); | |||||||||||||||||||||||||||
| 126 | 184 | undef $_watcher_timer; | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 184 | EV::break(); | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | sub _die_handler { | ||||||||||||||||||||||||||||
| 132 | 0 | ▶ | EV_DEBUG && warn "_die_handler( $@ )\n"; | ||||||||||||||||||||||||||
|
Subroutine
_die_handler: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | # EV doesn't let you rethrow an error here, so we have | ||||||||||||||||||||||||||||
| 135 | # to stop the loop and get the error later | ||||||||||||||||||||||||||||
| 136 | 0 | $DIE_MESSAGE = $@; | |||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | # This will cause the EV::run call in loop_run to return, | ||||||||||||||||||||||||||||
| 139 | # and cause the process to die. | ||||||||||||||||||||||||||||
| 140 | 0 | EV::break(); | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | ############################################################################ | ||||||||||||||||||||||||||||
| 144 | # Timer code | ||||||||||||||||||||||||||||
| 145 | ############################################################################ | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | sub loop_resume_time_watcher { | ||||||||||||||||||||||||||||
| 148 | 1463 | ▶ | my ( $self, $next_time ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
loop_resume_time_watcher: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 149 | 1463 | ▶ | ( $_watcher_timer and $next_time ) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_watcher_timer and $next_time
MC/DC0%0/2
$_watcher_timer and $next_time
$_watcher_timer
$next_time
Truth table33%1/3
A and B
A= $_watcher_timerB= $next_time
| |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 1463 | ▶ | EV_DEBUG && warn "loop_resume_time_watcher( $next_time, in " . ( $next_time - time() ) . " )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 1463 | $_watcher_timer->set($next_time); | |||||||||||||||||||||||||||
| 154 | 1463 | $_watcher_timer->start(); | |||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | sub loop_reset_time_watcher { | ||||||||||||||||||||||||||||
| 158 | 1504 | ▶ | my ( $self, $next_time ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
loop_reset_time_watcher: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 159 | 1504 | ▶ | ( $_watcher_timer and $next_time ) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_watcher_timer and $next_time
MC/DC0%0/2
$_watcher_timer and $next_time
$_watcher_timer
$next_time
Truth table33%1/3
A and B
A= $_watcher_timerB= $next_time
| |||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 1504 | ▶ | EV_DEBUG && warn "loop_reset_time_watcher( $next_time, in " . ( $next_time - time() ) . " )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 1504 | $_watcher_timer->set($next_time); | |||||||||||||||||||||||||||
| 164 | 1504 | $_watcher_timer->start(); | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | sub loop_pause_time_watcher { | ||||||||||||||||||||||||||||
| 168 | 651 | ▶ | $_watcher_timer or return; | ||||||||||||||||||||||||||
|
Subroutine
loop_pause_time_watcher: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 467 | ▶ | EV_DEBUG && warn "loop_pause_time_watcher()\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 467 | $_watcher_timer->stop(); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | ############################################################################ | ||||||||||||||||||||||||||||
| 176 | # Filehandle code | ||||||||||||||||||||||||||||
| 177 | ############################################################################ | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | # helper function, not a method | ||||||||||||||||||||||||||||
| 180 | sub _mode_to_ev { | ||||||||||||||||||||||||||||
| 181 | 1317 | ▶ | return EV::READ if $_[0] == MODE_RD; | ||||||||||||||||||||||||||
|
Subroutine
_mode_to_ev: called CC=4 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | 556 | ▶ | return EV::WRITE if $_[0] == MODE_WR; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | confess "POE::Loop::EV does not support MODE_EX" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | if $_[0] == MODE_EX; | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | confess "Unknown mode $_[0]"; | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | sub loop_watch_filehandle { | ||||||||||||||||||||||||||||
| 191 | 1317 | ▶ | my ( $self, $handle, $mode ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
loop_watch_filehandle: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 1317 | my $fileno = fileno($handle); | |||||||||||||||||||||||||||
| 194 | 1317 | my $watcher = $fileno_watcher[ $fileno ]->[ $mode ]; | |||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 1317 | ▶ | if ( defined $watcher ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 0 | $watcher->stop(); | |||||||||||||||||||||||||||
| 198 | 0 | undef $fileno_watcher[ $fileno ]->[ $mode ]; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 1317 | ▶ | EV_DEBUG && warn "loop_watch_filehandle( $handle ($fileno), $mode )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 1317 | $fileno_watcher[ $fileno ]->[ $mode ] = EV::io( | |||||||||||||||||||||||||||
| 204 | $fileno, | ||||||||||||||||||||||||||||
| 205 | _mode_to_ev($mode), | ||||||||||||||||||||||||||||
| 206 | \&_loop_filehandle_callback, | ||||||||||||||||||||||||||||
| 207 | ); | ||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | sub loop_ignore_filehandle { | ||||||||||||||||||||||||||||
| 211 | 1176 | ▶ | my ( $self, $handle, $mode ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
loop_ignore_filehandle: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 1176 | my $fileno = fileno($handle); | |||||||||||||||||||||||||||
| 214 | 1176 | my $watcher = $fileno_watcher[ $fileno ]->[ $mode ]; | |||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 1176 | ▶ | return if !defined $watcher; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 1176 | ▶ | EV_DEBUG && warn "loop_ignore_filehandle( $handle ($fileno), $mode )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 1176 | $watcher->stop(); | |||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 1176 | undef $fileno_watcher[ $fileno ]->[ $mode ]; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | sub loop_pause_filehandle { | ||||||||||||||||||||||||||||
| 226 | 1144 | ▶ | my ( $self, $handle, $mode ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
loop_pause_filehandle: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 1144 | my $fileno = fileno($handle); | |||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 1144 | $fileno_watcher[ $fileno ]->[ $mode ]->stop(); | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 1144 | ▶ | EV_DEBUG && warn "loop_pause_filehandle( $handle ($fileno), $mode )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | sub loop_resume_filehandle { | ||||||||||||||||||||||||||||
| 236 | 988 | ▶ | my ( $self, $handle, $mode ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
loop_resume_filehandle: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 988 | my $fileno = fileno($handle); | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 988 | $fileno_watcher[ $fileno ]->[ $mode ]->start(); | |||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 988 | ▶ | EV_DEBUG && warn "loop_resume_filehandle( $handle ($fileno), $mode )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | sub _loop_filehandle_callback { | ||||||||||||||||||||||||||||
| 246 | 2298 | ▶ | my ( $watcher, $ev_mode ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_loop_filehandle_callback: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 2298 | ▶ | EV_DEBUG && warn "_loop_filehandle_callback( " . $watcher->fh . ", $ev_mode )\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 2298 | ▶ | my $mode = ( $ev_mode == EV::READ ) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 251 | ? MODE_RD | ||||||||||||||||||||||||||||
| 252 | : ( $ev_mode == EV::WRITE ) | ||||||||||||||||||||||||||||
| 253 | ? MODE_WR | ||||||||||||||||||||||||||||
| 254 | : confess "Invalid mode occured in POE::Loop::EV IO callback: $ev_mode"; | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | # ->fh is actually the fileno, since that's what we called EV::io with | ||||||||||||||||||||||||||||
| 257 | 2298 | $poe_kernel->_data_handle_enqueue_ready( $mode, $watcher->fh ); | |||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 2298 | $poe_kernel->_test_if_kernel_is_idle(); | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 137 | 1; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | __END__ | ||||||||||||||||||||||||||||