This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: linux signals

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]