>> or rendezvous
> 
> i'm not sure rendezvous is an option here (you've no control over the child
> process after execing it), and even if you did (e.g. by doing the wait in 
> another
> process), it still doesn't get around the fact that
> when the data's large you need to be reading it at the same time that
> the child is writing it - there's no appropriate time to rendezvous.

right. Axel's question was about running resample in parallel.
as to why it works with a sleep, it's all stated in pipe(3). if you give
enough time to resample, it gets the first read on the pipe,
then parent gets the second read - which will come from a
write from resample.

i was thinking 
        switch (fork()) {
        child:  while (1) { rendezvous(0,0); if (read()<0)exit(); 
rendezvous(1,1); write(); }
        parent: while (more) { rendezvous(0,1); write(); rendezvous(1,0); 
read(); }
        }

which isn't possible with an uncooperative program, and is a little dangerous.

wouldn't ioproc(2) be a better solution for this class of problems?

Reply via email to