Hey everyone:

Anyone using fork() in Win32 ActivePerl?

Consider the following code:

<code>

        use FileHandle;

        STDOUT->autoflush(1);

        $kidpid = fork();
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";
        print "pid = $$ kidpid = $kidpid\n";

</code>

I would have thought that the child and parent output would be intermingled.

But they don't, the child code gets executed after the parent code is complete.  Which 
kinda defeats the purpose.

I have even put in a while() after this that bails when I tell it.  The child code 
gets executed once I let the parent process terminate, or at least the output arrives 
after the output of the first is complete.  But I have stdout autoflushed.

Am I missing something here?

Paul.





---------------------------------------------------------------------------------------------------------------------------
CRESTCo Ltd.             The views expressed above are not necessarily those
33 Cannon Street.        held by CRESTCo Limited.
London  EC4M 5SB (UK)      
+44 (020) 7849 0000     http://www.crestco.co.uk 
---------------------------------------------------------------------------------------------------------------------------

Reply via email to