This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: linux signals
- To: Jagadish Chandra Prasad <jagadish at icmg dot nu>
- Subject: Re: linux signals
- From: Britton <fsblk at aurora dot uaf dot edu>
- Date: Thu, 30 Aug 2001 09:10:49 -0800 (AKDT)
- cc: <gcc at gcc dot gnu dot org>, <gcc at gnu dot org>, <libc-alpha at sources dot redhat dot com>
You are not gauranteed to get a distinct SIGCHLD for each and every CHLD
that terminates, you just get one to indicate that at least one child has
terminated. Since you are SIGTERM ing all children at once, the
SIGCHLD signal(s) you are getting probably each correspond to the
termination of multiple children.
It may be possible to use real time signals, which are queued, but I'd
just find some different way to do it if I were you, like mayby with wait
or waitpid.
Britton Kerin
On Thu, 30 Aug 2001, Jagadish Chandra Prasad wrote:
> Hi,
> I have problem while using linux signals.some signals are lost.
> I have a signal handler for SIGCHLD.
> my signal handler code is.,
>
> void handler(int i)
>
>
> cout<<"Inside Handler:"<<getpid()<<":"<<i<<endl;
> int status;
> pid_t pid=wait(&status);
> if(pid >0 ){
> cout<<"Child:"<<pid<<" exited with :"<<status<<endl;
> }
> }
>
> I am initialising signal handler as.,
>
> struct sigaction sa;
> sigemptyset( &sa.sa_mask );
> sa.sa_flags = 0;
> sa.sa_handler = handler;
> sigaction( SIGCHLD, &sa, 0 );
>
>
> i have some 10 child processes running. i am issuing SIGTERM on all child
> processes at a time using killall.
> but handler is not called for 10 times.
> some child processes are becoming <defunct>.
>
> i am using glibc 2.1.3 and kernel 2.2.14
> can someone explain whats happenning.
>
> Regards,
> Jagadish
>
>