'how to capture the child process termination when the parent process is waiting the signal from child process

now my parent process is suspended to wait the siguser1 from child process like this

sigset_t mask;
sigfillset(&mask);
sigdelset(&mask, SIGUSR1);
sigsuspend(&mask); 

so my parent has been blocked. but sometimes the child process will not send the siguser1 to the parent process but terminate first. So how can the parent process know the child process terminate already and not to wait the signal and do the next process. what's more, i find that wait is also not working because it will block the parent process.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source