in reply to parallel forkmanager and unexpected duplicates.

Did you try setting STDOUT to autoflush?
$|=1;
I'm completely guessing, but if there's stuff in the STDOUT buffer, and then the child processes flush STDOUT on exit, that could explain the dupes...

If that's the case, you should also make sure you select BADADDR and GOODADDR before the fork and do the same for them; I'm not sure if the unlock would do the flush for you.

(Edit: The seek would do the flush, but the print happens AFTER the seek.)

my $oldfh=select(BADADDR); $|=1; select(GOODADDR); $|=1; select($oldfh); # reselect STDOUT

--
Mike

Replies are listed 'Best First'.
Re: parallel forkmanager and unexpected duplicates.
by Abigail-II (Bishop) on Jul 12, 2002 at 16:24 UTC
    From the manual page of fork
                   Beginning with v5.6.0, Perl will attempt to flush
                   all files opened for output before forking the
                   child process, but this may not be supported on
                   some platforms (see the perlport manpage).  To be
                   safe, you may need to set "$|" ($AUTOFLUSH in
                   English) or call the "autoflush()" method of
                   "IO::Handle" on any open handles in order to avoid
                   duplicate output.
    

    Abigail

Re: Re: parallel forkmanager and unexpected duplicates.
by neilwatson (Priest) on Jul 12, 2002 at 16:25 UTC
    Good guess!

    Adding $|=1; after my print to the browser did the trick.

    Thanks,

    Neil Watson
    watson-wilson.ca