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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.180 by root, Sat Sep 6 07:00:45 2008 UTC vs.
Revision 1.181 by root, Sat Sep 6 10:54:32 2008 UTC

340=head2 CHILD PROCESS WATCHERS 340=head2 CHILD PROCESS WATCHERS
341 341
342You can also watch on a child process exit and catch its exit status. 342You can also watch on a child process exit and catch its exit status.
343 343
344The child process is specified by the C<pid> argument (if set to C<0>, it 344The child process is specified by the C<pid> argument (if set to C<0>, it
345watches for any child process exit). The watcher will trigger as often 345watches for any child process exit). The watcher will triggered only when
346as status change for the child are received. This works by installing a 346the child process has finished and an exit status is available, not on
347signal handler for C<SIGCHLD>. The callback will be called with the pid 347any trace events (stopped/continued).
348and exit status (as returned by waitpid), so unlike other watcher types, 348
349you I<can> rely on child watcher callback arguments. 349The callback will be called with the pid and exit status (as returned by
350waitpid), so unlike other watcher types, you I<can> rely on child watcher
351callback arguments.
352
353This watcher type works by installing a signal handler for C<SIGCHLD>,
354and since it cannot be shared, nothing else should use SIGCHLD or reap
355random child processes (waiting for specific child processes, e.g. inside
356C<system>, is just fine).
350 357
351There is a slight catch to child watchers, however: you usually start them 358There is a slight catch to child watchers, however: you usually start them
352I<after> the child process was created, and this means the process could 359I<after> the child process was created, and this means the process could
353have exited already (and no SIGCHLD will be sent anymore). 360have exited already (and no SIGCHLD will be sent anymore).
354 361
854no warnings; 861no warnings;
855use strict qw(vars subs); 862use strict qw(vars subs);
856 863
857use Carp; 864use Carp;
858 865
859our $VERSION = 4.233; 866our $VERSION = 4.234;
860our $MODEL; 867our $MODEL;
861 868
862our $AUTOLOAD; 869our $AUTOLOAD;
863our @ISA; 870our @ISA;
864 871

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines