… | |
… | |
76 | |
76 | |
77 | =cut |
77 | =cut |
78 | |
78 | |
79 | package EV; |
79 | package EV; |
80 | |
80 | |
81 | no warnings; |
81 | use common::sense; |
82 | use strict; |
|
|
83 | |
82 | |
84 | BEGIN { |
83 | BEGIN { |
85 | our $VERSION = '3.6'; |
84 | our $VERSION = '3.9'; |
86 | use XSLoader; |
85 | use XSLoader; |
87 | XSLoader::load "EV", $VERSION; |
86 | XSLoader::load "EV", $VERSION; |
88 | } |
87 | } |
89 | |
88 | |
90 | @EV::IO::ISA = |
89 | @EV::IO::ISA = |
… | |
… | |
332 | These advanced functions set the minimum block interval when polling for I/O events and the minimum |
331 | These advanced functions set the minimum block interval when polling for I/O events and the minimum |
333 | wait interval for timer events. See the libev documentation at |
332 | wait interval for timer events. See the libev documentation at |
334 | L<http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_THE_EVENT_LOOP> |
333 | L<http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_THE_EVENT_LOOP> |
335 | (locally installed as F<EV::libev>) for a more detailed discussion. |
334 | (locally installed as F<EV::libev>) for a more detailed discussion. |
336 | |
335 | |
|
|
336 | =item $count = EV::pending_count |
|
|
337 | |
|
|
338 | =item $count = $loop->pending_count |
|
|
339 | |
|
|
340 | Returns the number of currently pending watchers. |
|
|
341 | |
|
|
342 | =item EV::invoke_pending |
|
|
343 | |
|
|
344 | =item $loop->invoke_pending |
|
|
345 | |
|
|
346 | Invoke all currently pending watchers. |
|
|
347 | |
337 | =back |
348 | =back |
338 | |
349 | |
339 | |
350 | |
340 | =head1 WATCHER OBJECTS |
351 | =head1 WATCHER OBJECTS |
341 | |
352 | |
… | |
… | |
445 | |
456 | |
446 | =item $previous_state = $w->keepalive ($bool) |
457 | =item $previous_state = $w->keepalive ($bool) |
447 | |
458 | |
448 | Normally, C<EV::loop> will return when there are no active watchers |
459 | Normally, C<EV::loop> will return when there are no active watchers |
449 | (which is a "deadlock" because no progress can be made anymore). This is |
460 | (which is a "deadlock" because no progress can be made anymore). This is |
450 | convinient because it allows you to start your watchers (and your jobs), |
461 | convenient because it allows you to start your watchers (and your jobs), |
451 | call C<EV::loop> once and when it returns you know that all your jobs are |
462 | call C<EV::loop> once and when it returns you know that all your jobs are |
452 | finished (or they forgot to register some watchers for their task :). |
463 | finished (or they forgot to register some watchers for their task :). |
453 | |
464 | |
454 | Sometimes, however, this gets in your way, for example when the module |
465 | Sometimes, however, this gets in your way, for example when the module |
455 | that calls C<EV::loop> (usually the main program) is not the same module |
466 | that calls C<EV::loop> (usually the main program) is not the same module |
… | |
… | |
687 | |
698 | |
688 | =item $w = EV::signal $signal, $callback |
699 | =item $w = EV::signal $signal, $callback |
689 | |
700 | |
690 | =item $w = EV::signal_ns $signal, $callback |
701 | =item $w = EV::signal_ns $signal, $callback |
691 | |
702 | |
|
|
703 | =item $w = $loop->signal ($signal, $callback) |
|
|
704 | |
|
|
705 | =item $w = $loop->signal_ns ($signal, $callback) |
|
|
706 | |
692 | Call the callback when $signal is received (the signal can be specified by |
707 | Call the callback when $signal is received (the signal can be specified by |
693 | number or by name, just as with C<kill> or C<%SIG>). |
708 | number or by name, just as with C<kill> or C<%SIG>). |
|
|
709 | |
|
|
710 | Only one event loop can grab a given signal - attempting to grab the same |
|
|
711 | signal from two EV loops will crash the program immediately or cause data |
|
|
712 | corruption. |
694 | |
713 | |
695 | EV will grab the signal for the process (the kernel only allows one |
714 | EV will grab the signal for the process (the kernel only allows one |
696 | component to receive a signal at a time) when you start a signal watcher, |
715 | component to receive a signal at a time) when you start a signal watcher, |
697 | and removes it again when you stop it. Perl does the same when you |
716 | and removes it again when you stop it. Perl does the same when you |
698 | add/remove callbacks to C<%SIG>, so watch out. |
717 | add/remove callbacks to C<%SIG>, so watch out. |