Hi,
I recently worked with AnyEvent very often, it's very nice !
My question is about AnyEvent with fork ( not the module AnyEvent::Fork ),
here is my code:
use AnyEvent;
my $cv = AE::cv;
my $count = 0;
my $w; $w = AE::timer 1, 1, sub {
print "timer $count \n";
$count += 1;
};
my $w1; $w1 = AE::timer 4, 0, sub {
my $pid = fork();
if ( $pid ) {
return;
} else { # child
sleep 10;
print "child end\n";
exit 0;
}
};
my $w2; $w2 = AE::io \*STDIN, 0, sub {
print "STDIN readable\n";
my $msg = <STDIN>;
print $msg . "\n";
};
$cv->recv;
this will got:
timer 1
timer 2
...
child end
I wondered when it fork a subprocess in callback, the parent process's ENV,
File Descriptor, all things will be copied to subprocess, so the $cv, $w
will be copied too, so I thought the 'event loop' and 'watcher' in main
process will be copied too, but it seems not, there was not timer watch be
trigger in subprocess, what I missed ?
Best Regards
_______________________________________________
anyevent mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/anyevent