in reply to Re^2: Logical Conundrum
in thread Logical Conundrum

As tilly pointed out, it's doable with locks, but since the semantics of locks after a fork differs from system to system, you first need to know the system before you can present a solution.

But there's a different solution. Instead of fork/exec, with the children doing the prints, open *pipes* to the children, and have the children write to the pipes. The the parent can decide in which order the results will be printed. Beware, if there's a lot of data to be printed, of which a lot is available long before the end of the life of the child, it might not work to well.

Abigail

Replies are listed 'Best First'.
Re: Re: Logical Conundrum
by mcogan1966 (Monk) on Dec 01, 2003 at 21:10 UTC
    Actually, that was what the first version did, and it didn't work to well either. Hence the fork/system calls. Same problem, but things seemd to move faster. Not necessarily such a good thing, but if I didn't generate any new problem, I'll keep it that way, for now.

    My scratchpad has some of the code I'm trying to muddle through. Maybe that'll offer some ideas.