… | |
… | |
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 = '3.0'; |
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 = |
… | |
… | |
155 | |
155 | |
156 | Returns the set (see C<EV::BACKEND_*> flags) of backends supported by this |
156 | Returns the set (see C<EV::BACKEND_*> flags) of backends supported by this |
157 | instance of EV, the set of recommended backends (supposed to be good) for |
157 | instance of EV, the set of recommended backends (supposed to be good) for |
158 | this platform and the set of embeddable backends (see EMBED WATCHERS). |
158 | this platform and the set of embeddable backends (see EMBED WATCHERS). |
159 | |
159 | |
|
|
160 | =item EV::sleep $seconds |
|
|
161 | |
|
|
162 | Block the process for the given number of (fractional) seconds. |
|
|
163 | |
160 | =item $time = EV::time |
164 | =item $time = EV::time |
161 | |
165 | |
162 | Returns the current time in (fractional) seconds since the epoch. |
166 | Returns the current time in (fractional) seconds since the epoch. |
163 | |
167 | |
164 | =item $time = EV::now |
168 | =item $time = EV::now |
… | |
… | |
640 | |
644 | |
641 | =head3 CHILD WATCHERS - watch out for process status changes |
645 | =head3 CHILD WATCHERS - watch out for process status changes |
642 | |
646 | |
643 | =over 4 |
647 | =over 4 |
644 | |
648 | |
645 | =item $w = EV::child $pid, $callback |
649 | =item $w = EV::child $pid, $trace, $callback |
646 | |
650 | |
647 | =item $w = EV::child_ns $pid, $callback |
651 | =item $w = EV::child_ns $pid, $trace, $callback |
648 | |
652 | |
649 | =item $w = $loop->child ($pid, $callback) |
653 | =item $w = $loop->child ($pid, $trace, $callback) |
650 | |
654 | |
651 | =item $w = $loop->child_ns ($pid, $callback) |
655 | =item $w = $loop->child_ns ($pid, $trace, $callback) |
652 | |
656 | |
653 | 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 |
654 | 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 |
655 | 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 |
656 | changed/zombie children and call the callback. |
662 | changed/zombie children and call the callback. |
657 | |
663 | |
658 | 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 |
659 | 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 |
… | |
… | |
666 | 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 |
667 | called. |
673 | called. |
668 | |
674 | |
669 | 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. |
670 | |
676 | |
671 | =item $w->set ($pid) |
677 | =item $w->set ($pid, $trace) |
672 | |
678 | |
673 | 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 |
674 | any time. |
680 | any time. |
675 | |
681 | |
676 | =item $current_pid = $w->pid |
682 | =item $current_pid = $w->pid |
677 | |
|
|
678 | =item $old_pid = $w->pid ($new_pid) |
|
|
679 | |
683 | |
680 | 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. |
681 | |
685 | |
682 | =item $exit_status = $w->rstatus |
686 | =item $exit_status = $w->rstatus |
683 | |
687 | |