ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV.pm
(Generate patch)

Comparing EV/EV.pm (file contents):
Revision 1.80 by root, Sat Dec 22 16:48:33 2007 UTC vs.
Revision 1.84 by root, Fri Feb 1 13:08:54 2008 UTC

35 warn "sigquit received\n"; 35 warn "sigquit received\n";
36 }; 36 };
37 37
38 # CHILD/PID STATUS CHANGES 38 # CHILD/PID STATUS CHANGES
39 39
40 my $w = EV::child 666, sub { 40 my $w = EV::child 666, 0, sub {
41 my ($w, $revents) = @_; 41 my ($w, $revents) = @_;
42 my $status = $w->rstatus; 42 my $status = $w->rstatus;
43 }; 43 };
44 44
45 # STAT CHANGES 45 # STAT CHANGES
68package EV; 68package EV;
69 69
70use strict; 70use strict;
71 71
72BEGIN { 72BEGIN {
73 our $VERSION = '2.0'; 73 our $VERSION = '3.1';
74 use XSLoader; 74 use XSLoader;
75 XSLoader::load "EV", $VERSION; 75 XSLoader::load "EV", $VERSION;
76} 76}
77 77
78@EV::IO::ISA = 78@EV::IO::ISA =
84@EV::Idle::ISA = 84@EV::Idle::ISA =
85@EV::Prepare::ISA = 85@EV::Prepare::ISA =
86@EV::Check::ISA = 86@EV::Check::ISA =
87@EV::Embed::ISA = 87@EV::Embed::ISA =
88@EV::Fork::ISA = 88@EV::Fork::ISA =
89@EV::Async::ISA =
89 "EV::Watcher"; 90 "EV::Watcher";
90 91
91@EV::Loop::Default::ISA = "EV::Loop"; 92@EV::Loop::Default::ISA = "EV::Loop";
92 93
93=head1 EVENT LOOPS 94=head1 EVENT LOOPS
644 645
645=head3 CHILD WATCHERS - watch out for process status changes 646=head3 CHILD WATCHERS - watch out for process status changes
646 647
647=over 4 648=over 4
648 649
649=item $w = EV::child $pid, $callback 650=item $w = EV::child $pid, $trace, $callback
650 651
651=item $w = EV::child_ns $pid, $callback 652=item $w = EV::child_ns $pid, $trace, $callback
652 653
653=item $w = $loop->child ($pid, $callback) 654=item $w = $loop->child ($pid, $trace, $callback)
654 655
655=item $w = $loop->child_ns ($pid, $callback) 656=item $w = $loop->child_ns ($pid, $trace, $callback)
656 657
657Call the callback when a status change for pid C<$pid> (or any pid if 658Call the callback when a status change for pid C<$pid> (or any pid
658C<$pid> is 0) has been received. More precisely: when the process receives 659if C<$pid> is 0) has been received (a status change happens when the
660process terminates or is killed, or, when trace is true, additionally when
661it is stopped or continued). More precisely: when the process receives
659a C<SIGCHLD>, EV will fetch the outstanding exit/wait status for all 662a C<SIGCHLD>, EV will fetch the outstanding exit/wait status for all
660changed/zombie children and call the callback. 663changed/zombie children and call the callback.
661 664
662It is valid (and fully supported) to install a child watcher after a child 665It is valid (and fully supported) to install a child watcher after a child
663has exited but before the event loop has started its next iteration (for 666has exited but before the event loop has started its next iteration (for
670You can have as many pid watchers per pid as you want, they will all be 673You can have as many pid watchers per pid as you want, they will all be
671called. 674called.
672 675
673The C<child_ns> variant doesn't start (activate) the newly created watcher. 676The C<child_ns> variant doesn't start (activate) the newly created watcher.
674 677
675=item $w->set ($pid) 678=item $w->set ($pid, $trace)
676 679
677Reconfigures the watcher, see the constructor above for details. Can be called at 680Reconfigures the watcher, see the constructor above for details. Can be called at
678any time. 681any time.
679 682
680=item $current_pid = $w->pid 683=item $current_pid = $w->pid
681
682=item $old_pid = $w->pid ($new_pid)
683 684
684Returns the previously set process id and optionally set a new one. 685Returns the previously set process id and optionally set a new one.
685 686
686=item $exit_status = $w->rstatus 687=item $exit_status = $w->rstatus
687 688
968 969
969The C<embed_ns> variant doesn't start (activate) the newly created watcher. 970The C<embed_ns> variant doesn't start (activate) the newly created watcher.
970 971
971=back 972=back
972 973
974=head3 ASYNC WATCHERS - how to wake up another event loop
975
976Async watchers are provided by EV, but have little use in perl directly, as perl
977neither supports threads nor direct access to signal handlers or other
978contexts where they could be of value.
979
980It is, however, possible to use them from the XS level.
981
982Please see the libev documentation for further details.
983
973 984
974=head1 PERL SIGNALS 985=head1 PERL SIGNALS
975 986
976While Perl signal handling (C<%SIG>) is not affected by EV, the behaviour 987While Perl signal handling (C<%SIG>) is not affected by EV, the behaviour
977with EV is as the same as any other C library: Perl-signals will only be 988with EV is as the same as any other C library: Perl-signals will only be

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines