Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: yeung@ncar.ucar.edu (David Yeung)
Subject: SIGCHLD signal problem in OSF1 3.0
Date: 1995/04/06	[thread overview]
Message-ID: <3m16e8$reo@ncar.ucar.edu> (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
--




             reply	other threads:[~1995-04-06  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-04-06  4:00 David Yeung [this message]
1995-04-12  4:00 ` SIGCHLD signal problem in OSF1 3.0 Jon Jenkins
read-only archive

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