i have program which sends signal SIGCHLD to all other processes in the system TWICE. problem is, its sent only once.
program sending the signal:
int main(){
kill(-1, SIGCHLD);
sleep(8);
kill(-1, SIGCHLD);
return 0;}
program getting the signals:
int main(){
struct sigaction sigchldHandler;
sigchldHandler.sa_flags = 0;
sigset_t BlockMask;
sigfillset(&BlockMask);
sigchldHandler.sa_mask = BlockMask;
sigchldHandler.sa_handler = sigchldFunction;
if( sigaction( SIGCHLD, &sigchldHandler, NULL ) != 0 ){
perror( "sigaction() error\n" );}
while(1){
pause()}
return 0;
}
the function is:
void sigchldFunction(int signal){
write(1, "gets here only once\n", strlen("gets here only once\n"));
startHandling();
}
why doesn't it get the second signal, byt only the first one? ...HELP??