Fri Nov 20 15:11:14 CET 2009

channel teardown

Channels are quite simple.  What's not simple is to represent
end-of-stream and teardown without causing deadlock.

But.. calling an external app with both input and output isn't so
simple.  Something goes wrong in the synchronization: i get commands
that do not output anything.

If I perform the commands manually everything works fine.

Yes..  This is too complicated to get right.  The bric-a-brac resource
management simply doesn't work.

Other possibilities:  use only a feeder thread, and read the output of
the process synchronously.

But, given the trouble this creates and the difficulty of debugging a
multi-threaded app in gdb, I'm thinking about moving to non-blocking

Let's create a special case: execute an external program, feeding it
binary data on stdin, and collect its stout in a buffer.  Sequence the
reads & writes with select.

Is it possible to move from FILE to fd's?  For output this is just
flush.  How does input work?