简体   繁体   English

AIX,子进程退出时,父进程无法捕获SIGCHLD

[英]AIX, Parent process unable to catch SIGCHLD when child exits

我的父进程无法捕获SIGCHLD,即使它在waitpid(SIGCHLD ...)上也是如此。尝试从孩子给父进程一个明确的kill(SIGCHLD ..)以测试父进程没有收到信号。风味是AIX ...我们需要用一些标志或一些环境设置来编译它吗?

You need to register a signal handler to catch SIGCHLD. 您需要注册一个信号处理程序以捕获SIGCHLD。 waitpid is related but different from SIGCHLD. waitpid是相关的,但与SIGCHLD不同。 Use either signal(3) or sigaction(2) to register your signal handler. 使用signal(3)sigaction(2)注册您的信号处理程序。

To use waitpid do: 要使用waitpid,请执行以下操作:

pid_t x = fork();
...
pid_t y = waitpid(x, &status, options);

SIGCHLD really just tells you that you need to call one of the wait functions. SIGCHLD实际上只是告诉您您需要调用其中一个等待函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM