Boost logo

Boost :

From: Oliver.Kowalke_at_[hidden]
Date: 2006-08-17 07:01:54


Hi,
I would suggest to implement the possiblility to wait for a
child/children (non blocking) inside of a SIGCHLD signal handler
function.
On POSIX the implementation would look like:

// while loop inside of signal handling function (SIGCHLD)
while ( true)
{
pid_t pid;
int stat = 0, opts = WNOHANG | WUNTRACED;
#ifdef WCONTINUED
opts |= WCONTINUED;
#endif
pid = ::waitpid( -1, & stat, opts);
if ( pid == 0)
        break;
else if ( pid < 0)
        throw sys::system_error( sys::error_code( errno, sys::errno_ec)
);

child c( pid, status( stat) );
...
}

regards,
Oliver


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