[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2197.0. "How can i get signal(SIGCHLD) from every child process ?" by NNTPD::"[email protected]" (SeokHwanLee) Tue May 20 1997 23:25

I have a problem in signal program.
When child process exited, Parent process can't get all SIGCHLD signal
from child process. At next following sample program, Parent prcess get
SIGCHLD
signal 2 times(Irregularity).
How can Parent process get signal(SIGCHLD) every time when child process
exited ?
Parent Process can get every SIGCHLD signal from child at SUN Solaris, HP-UX.

------------------------------------------------------------------------
#include        <signal.h>

void
sigh( int n )
{
        int     cpid;

        signal(SIGCHLD, sigh);
        printf( "11111111---SIGH\n" );
        cpid=wait( (int *)0 );
        printf( "sigh function cpid = %d\n", cpid );
}

void
main()
{
        int             cpid=0;

        signal(SIGCHLD, sigh);
        if( (cpid = fork()) == 0 )
        {
                printf("fork1 ok\n");
                exit();
        }
        printf("1: cpid = %d \n", cpid);
        if( (cpid = fork()) == 0 )
        {
              printf(fork2 ok\n"};
              exit();
        }
        printf("2: cpid = %d \n", cpid);
        if( (cpid = fork()) == 0 )
        {
                printf("fork3 ok\n");
                exit();
        }
        printf("3: cpid = %d \n", cpid);

        sleep( 3 );
        while( 1 )
        {
                printf( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" );
                sleep( 2 );
        }
}


[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
2197.1Being discussed in Digital UNIXTLE::D_SMITHDuane Smith -- DEC C RTLWed May 21 1997 07:394
    This is also posted in DIGITAL_UNIX and is being worked by them.  At
    first, I was going to ask the standard reply about OS and version,
    until I tried to build it on OpenVMS and saw use of fork() which is not
    present on OpenVMS.