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

Comparing AnyEvent-Fork/Fork.pm (file contents):
Revision 1.29 by root, Sat Apr 6 09:15:49 2013 UTC vs.
Revision 1.30 by root, Sat Apr 6 09:28:45 2013 UTC

152 152
153 # now $master_filehandle is connected to the 153 # now $master_filehandle is connected to the
154 # $slave_filehandle in the new process. 154 # $slave_filehandle in the new process.
155 }); 155 });
156 156
157 # MyModule::worker might look like this 157MyModule::worker might look like this:
158
158 sub MyModule::worker { 159 sub MyModule::worker {
159 my ($slave_filehandle) = @_; 160 my ($slave_filehandle) = @_;
160 161
161 # now $slave_filehandle is connected to the $master_filehandle 162 # now $slave_filehandle is connected to the $master_filehandle
162 # in the original prorcess. have fun! 163 # in the original prorcess. have fun!
182 } 183 }
183 184
184 # now do other things - maybe use the filehandle provided by run 185 # now do other things - maybe use the filehandle provided by run
185 # to wait for the processes to die. or whatever. 186 # to wait for the processes to die. or whatever.
186 187
187 # My::Server::run might look like this 188My::Server::run might look like this:
189
188 sub My::Server::run { 190 sub My::Server::run {
189 my ($slave, $listener, $id) = @_; 191 my ($slave, $listener, $id) = @_;
190 192
191 close $slave; # we do not use the socket, so close it to save resources 193 close $slave; # we do not use the socket, so close it to save resources
192 194
560Normally, only processes created via C<< AnyEvent::Fork->new_exec >> and 562Normally, only processes created via C<< AnyEvent::Fork->new_exec >> and
561L<AnyEvent::Fork::Template> are direct children, and you are responsible 563L<AnyEvent::Fork::Template> are direct children, and you are responsible
562to clean up their zombies when they die. 564to clean up their zombies when they die.
563 565
564All other processes are not direct children, and will be cleaned up by 566All other processes are not direct children, and will be cleaned up by
565AnyEvent::Fork. 567AnyEvent::Fork itself.
566 568
567=cut 569=cut
568 570
569sub pid { 571sub pid {
570 $_[0][0] 572 $_[0][0]

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines