Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* SIGCHLD signal problem in OSF1 3.0
@ 1995-04-06  4:00 David Yeung
  1995-04-12  4:00 ` Jon Jenkins
  0 siblings, 1 reply; 2+ messages in thread
From: David Yeung @ 1995-04-06  4:00 UTC (permalink / raw)


Hi

I am writing a problem trying to catch the SIGCHLD signal when any of
its child processes dies. But I find that some SIGCHLD signals are lost 
if more than one child processes terminate simultaneously.

Here is my test program:

================================================
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>

void    func1 ();

main()
{
    pid_t       pid;
    int         i;

    sigset(SIGCLD, func1);
    for (i=0;i<10;i++)  {
        if ((pid = fork ()) == 0)       {
                sleep (1);
                exit (1);
        }
        printf ("pid = %d\n", (int)pid);
    }
    for (;;);
}

void    func1 ()
{
        pid_t   pid;

        pid = wait (NULL);
        sigset(SIGCHLD, func1);
        printf ("func1 pid = %d\n", (int)pid);
}
=================================================

The program forks a number of processes and those child processes
terminates at around the same time. But the signal handler (func1)
can only catch one or two SIGCHLD signal. The others are lost. If
I change the statement "sleep (1)" to "sleep (i+1)", i.e, the
child processes are not terminated at the same time, then all
SIGCHLD signals are catched.

Does anyone know how to resolve this problem? This problem does
not appear in SGI and SUN Unix.

Thanks in advance.

David Yeung
--




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-04-12  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-04-06  4:00 SIGCHLD signal problem in OSF1 3.0 David Yeung
1995-04-12  4:00 ` Jon Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox