[Gllug] pipes and C++

Adrian McMenamin adrian at newgolddream.dyndns.info
Mon Sep 13 08:39:09 UTC 2010


On Sun, September 12, 2010 11:58 pm, Bruce Richardson wrote:
> On Sun, Sep 12, 2010 at 09:49:58PM +0100, Adrian McMenamin wrote:
>> I have been chaining three C++ programs I have written together -
>> working on the principle that each should do one thing - so
>>
>> A - generates some xml
>> B - processes said xml
>> C - outputs graphics
>>
>> A | B | C
>>
>> All works well - but now I want to have them repeat this every few
>> seconds ie for every three seconds
>>
>> A --r 3 | B --r 3 | C --r 3
>>
>> But while it is easy to get the first program to churn out the xml I
>> cannot work out how to get the second element in the chain to recognise
>> the end of the output - (I am guessing that previously B didn't really
>> start until A was dead?)
>
> No, that's not the case.  In fact, A and B run in parallel.  B reads
> from STDIN, which, since it directly connected to A's STDOUT, blocks
> until A writes to it.

Yes, I worked this out last night - process B was waiting around in the
XML parser: it throws an exception when A delivers its second batch of
output - querying why it has more XML after it has already received a
closing tag.

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list