当前位置: 技术问答>linux和unix
关于SIGCHLD信号问题
来源: 互联网 发布时间:2016-12-07
本文导语: typedef void Sigfunc(int); void sig_chld(int signo) { pid_t pid; int stat; while ((pid = waitpid(-1, &stat, WNOHANG)) > 0) { printf("child terminated %dn", pid); } return ; } Sigfunc *Signal(int signo, Sigfunc *func) { struct sigaction act, oact; act....
typedef void Sigfunc(int);
void sig_chld(int signo)
{
pid_t pid;
int stat;
while ((pid = waitpid(-1, &stat, WNOHANG)) > 0)
{
printf("child terminated %dn", pid);
}
return ;
}
Sigfunc *Signal(int signo, Sigfunc *func)
{
struct sigaction act, oact;
act.sa_handler = func;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
printf("......n");
if (sigaction(signo, &act, &oact)