Boost logo

Boost :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2004-06-23 10:52:31


Gregory Colvin wrote:

> On Jun 23, 2004, at 8:16 AM, Angus Leeming wrote:
>> ...
>> Can you explain why you favour doing things your way? (Assuming
>> that I've interpreted "your way" correctly this time ;-)...
>
> I can't speak for John, but I wouldn't want to pay the price for
> your signal handler if I'm going to wait for the child anyway.

Right. In light of this and the comments from both John Maddock and
John Fuller, I think that it is reasonable to say that waiting for
child processes is a complex undertaking.

What I propose to do, therefore, is to farm it off to a separate class
with an interface something like:

class unix_reaper : noncopyable {
public:
        static unix_reaper & get();
        bool is_running(pid_t);
        int exit_status(pid_t);
        // Invoked from unix_process::spawn().
        void register(pid_t);
        // Invoked from unix_process::~unix_process().
        void clean_up(pid_t);
private:
        unix_reaper();
        ~unix_reaper();
};

Thereafter, how this class goes about its business is an
implementation detail that is independent of the rest of the business
of interacting with a child process. I'll code up versions that do it
using either a signal handler or using John M's approach and will get
on with finishing off unix_process itself.

Many thanks for the input,
Angus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk