开发者

AIX, Parent process unable to catch SIGCHLD when child exits

开发者 https://www.devze.com 2023-01-16 09:39 出处:网络
my parent process is unable to catch the SIGCHLD even though its onwaitpid(SIGCHLD... for it开发者_如何学Go.

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

精彩评论

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

关注公众号