<div dir="ltr"><div>Hi,</div><div><br></div><div>I recently worked with AnyEvent very often, it's very nice !</div><div><br></div><div>My question is about AnyEvent with fork ( not the module AnyEvent::Fork ), here is my code:</div><div><br></div><div>use AnyEvent;</div><div><br></div><div>my $cv = AE::cv;</div><div>my $count = 0;</div><div>my $w; $w = AE::timer 1, 1, sub {</div><div>    print "timer $count \n";</div><div>    $count += 1;</div><div>};</div><div><br></div><div>my $w1; $w1 = AE::timer 4, 0, sub {</div><div>    my $pid = fork();</div><div>    if ( $pid ) {</div><div>        return;</div><div><br></div><div>    } else { # child</div><div>        sleep 10;</div><div>        print "child end\n";</div><div>        exit 0;</div><div>    }</div><div>};</div><div><br></div><div>my $w2; $w2 = AE::io \*STDIN, 0, sub {</div><div>    print "STDIN readable\n";</div><div>    my $msg = <STDIN>;</div><div>    print $msg . "\n";</div><div>};</div><div><br></div><div>$cv->recv;</div><div><br></div><div>this will got:</div><div>timer 1</div><div>timer 2</div><div>...</div><div>child end</div><div><br></div><div>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 ?</div><div><br></div><div>Best Regards</div></div>