开发者

AIX, Parent process unable to catch SIGCHLD when child exits

my parent process is unable to catch the SIGCHLD even though its on waitpid(SIGCHLD... for it开发者_如何学Go. Tried giving an explicit kill(SIGCHLD..) to the parent from the child to test the parent is not receiving the signal .also the flavor is AIX...do we need to compile it with some flags or some env setup ?


You need to register a signal handler to catch SIGCHLD. waitpid is related but different from SIGCHLD. Use either signal(3) or sigaction(2) to register your signal handler.

To use waitpid do:

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜