Boost logo

Boost :

From: Dan Nuffer (dan-boost_at_[hidden])
Date: 2005-02-21 00:35:19

Julio M. Merino Vidal wrote:
> Any comments?

I'd like to add that I think a process library is important and would be
quite useful for boost to have.

Having dealt with running processes quite a lot, I'd say one of the most
important features is providing a method of dealing with "misbehaving"
processes. This may not seem obvious at first, but I learned this
lesson the hard way several years ago. IMO, to be useful the library
must provide a recovery mechanism for the case where a child process
locks up and never produces any output or enters an infinite loop and
never stops producing output.

Here's some of the code I've written for dealing with processes:

Here is an interesting use case: In order to generate some entropy to
seed a random number generator, lacking a better source, a lot of child
processes are simultaneously executed and their output and timing are
added to the entropy pool. All processes are given 10 seconds to run,
and are terminated if they haven't exited. This may happen more often
than not, since one of the commands being run is tcpdump, and if 100
packets aren't captured in the allotted time it will still be running.


specifically randomSourceCommands, RandomOutputGatherer and their use at
the end of loadRandomness(). Given the Exec interface, it's quite
simple to accomplish the task.

It's also quite easy to integrate the code with iostreams, I've written
a trivial streambuffer that uses the UnnamedPipe interface.

Dan Nuffer

Boost list run by bdawes at, gregod at, cpdaniel at, john at