Linux: system() + SIGCHLD handling + multithreading

前端 未结 4 1873
北恋
北恋 2021-02-03 14:30

I have a multithreaded application that installs a handler for SIGCHLD that logs and reaps the child processes.
The problem I see starts when I\'m doing a call to syst

4条回答
  •  清酒与你
    2021-02-03 14:50

    For those who are still looking for the answer, there is an easier way to solve this problem:

    Rewrite SIGCHLD handler to use waitid call with flags WNOHANG|WNOWAIT to check child's PID before reaping them. You can optionally check /proc/PID/stat (or similar OS interface) for command name.

提交回复
热议问题