Waitpid equivalent with timeout?

前端 未结 10 1251
小鲜肉
小鲜肉 2020-11-27 12:10

Imagine I have a process that starts several child processes. The parent needs to know when a child exits.

I can use waitpid, but then if/when the paren

10条回答
  •  醉梦人生
    2020-11-27 13:07

    If you're going to use signals anyways (as per Steve's suggestion), you can just send the signal manually when you want to exit. This will cause waitpid to return EINTR and the thread can then exit. No need for a periodic alarm/restart.

提交回复
热议问题