[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

2193.0. "signal(SIGCHLD) problem in DEC C UNIX ?" by NNTPD::"[email protected]" (SeokHwanLee) Mon May 19 1997 04:51

I have a problem in signal program.
Programing Environment:
        Digital UNIX 3.2 & 4.0b
        DEC C
when child process exited, Parent process can't get all SIGCHLD signal 
from child process.
At next following test program, Parent prcess get SIGCHLD signal 2 times.
How can Parent process get signal(SIGCHLD) every time when child process
exited ?
At SUN Solaris, HP-UX, Parent Process can get every SIGCHLD signal from child.

#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
2193.1duplicateWIBBIN::NOYCEPulling weeds, pickin&#039; stonesMon May 19 1997 09:171
answered in 961.2