all -
I am attempting to use sigwait to wait for SIGCHLD from
children of my process
The following does not work (assumint that testchild just
sleeps and then exits)
I never get the signal.
on solaris 2.7 to make this work, i have to call
signal( SIGCHLD, sigHndlr ).
The sigHndlr never gets called cause the sigprocmask
blocks it
What am I doing wrong?
thanks
jack
-- begin testparent.c ----
#include <stdio.h>
#include <unistd.h>
#include <iostream.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
int main( int argc, char ** argv )
{
sigset_t newmask, oldmask;
int signo;
sigemptyset( &newmask );
if( sigaddset( &newmask, SIGCHLD ) )
perror( "sigaddset" );
if( sigprocmask( SIG_BLOCK, &newmask, NULL ) )
perror( "pthread_sigmask() error" );
char * argp[1];
argp[0] = NULL;
pid_t pid = fork( );
if( pid == 0 ) {
if( execv("./testchild", argp ) ) {
perror( "execv" );
}
}
cout << "before sigwait" << endl;
if( sigwait( &newmask, &signo ) )
perror( "sigwait error" );
if( signo == SIGCHLD )
cout << "testparent SIGCHLD" << endl;
}
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message