… | |
… | |
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 |
… | |
… | |
68 | package EV; |
68 | package EV; |
69 | |
69 | |
70 | use strict; |
70 | use strict; |
71 | |
71 | |
72 | BEGIN { |
72 | BEGIN { |
73 | our $VERSION = '2.0'; |
73 | our $VERSION = '2.01'; |
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 = |
… | |
… | |
644 | |
644 | |
645 | =head3 CHILD WATCHERS - watch out for process status changes |
645 | =head3 CHILD WATCHERS - watch out for process status changes |
646 | |
646 | |
647 | =over 4 |
647 | =over 4 |
648 | |
648 | |
649 | =item $w = EV::child $pid, $callback |
649 | =item $w = EV::child $pid, $trace, $callback |
650 | |
650 | |
651 | =item $w = EV::child_ns $pid, $callback |
651 | =item $w = EV::child_ns $pid, $trace, $callback |
652 | |
652 | |
653 | =item $w = $loop->child ($pid, $callback) |
653 | =item $w = $loop->child ($pid, $trace, $callback) |
654 | |
654 | |
655 | =item $w = $loop->child_ns ($pid, $callback) |
655 | =item $w = $loop->child_ns ($pid, $trace, $callback) |
656 | |
656 | |
657 | Call the callback when a status change for pid C<$pid> (or any pid if |
657 | Call the callback when a status change for pid C<$pid> (or any pid |
658 | C<$pid> is 0) has been received. More precisely: when the process receives |
658 | if C<$pid> is 0) has been received (a status change happens when the |
|
|
659 | process terminates or is killed, or, when trace is true, additionally when |
|
|
660 | it is stopped or continued). More precisely: when the process receives |
659 | a C<SIGCHLD>, EV will fetch the outstanding exit/wait status for all |
661 | a C<SIGCHLD>, EV will fetch the outstanding exit/wait status for all |
660 | changed/zombie children and call the callback. |
662 | changed/zombie children and call the callback. |
661 | |
663 | |
662 | It is valid (and fully supported) to install a child watcher after a child |
664 | It is valid (and fully supported) to install a child watcher after a child |
663 | has exited but before the event loop has started its next iteration (for |
665 | has exited but before the event loop has started its next iteration (for |
… | |
… | |
670 | You can have as many pid watchers per pid as you want, they will all be |
672 | You can have as many pid watchers per pid as you want, they will all be |
671 | called. |
673 | called. |
672 | |
674 | |
673 | The C<child_ns> variant doesn't start (activate) the newly created watcher. |
675 | The C<child_ns> variant doesn't start (activate) the newly created watcher. |
674 | |
676 | |
675 | =item $w->set ($pid) |
677 | =item $w->set ($pid, $trace) |
676 | |
678 | |
677 | Reconfigures the watcher, see the constructor above for details. Can be called at |
679 | Reconfigures the watcher, see the constructor above for details. Can be called at |
678 | any time. |
680 | any time. |
679 | |
681 | |
680 | =item $current_pid = $w->pid |
682 | =item $current_pid = $w->pid |
681 | |
|
|
682 | =item $old_pid = $w->pid ($new_pid) |
|
|
683 | |
683 | |
684 | Returns the previously set process id and optionally set a new one. |
684 | Returns the previously set process id and optionally set a new one. |
685 | |
685 | |
686 | =item $exit_status = $w->rstatus |
686 | =item $exit_status = $w->rstatus |
687 | |
687 | |